I have a simple search form - RoR displays form ok. All IP Address are
loaded from db. I want to select one of the IP Addresses listed, press
Submit, and have all the data from that IP address displayed. I am a
Ruby newbie - can someone help me figure out what I’m doing wrong? I
select the IP Address and get a list of ALL data (not the data
associated with that IP)
Here is how I get my list of IP addresses - this works fine - the list
is displayed:
Select IP Address: <%= collection_select("IpAddress", "ip", IpAddress.find_all, :id, "ip") %>
…
<%= submit_tag “Get Data” %>
<%= end_form_tag %>
…
Now in my IpAddressController I have the following defined:
def get_data
condi = nil
if params[:query]
condi = [“ip LIKE ?”, “%#{params[:query]}%”]
end
@result = Scan.find(:all, :conditions => condi)
end
…
Then I simply print it out in a table…but what is being printed out
now is all the data, not just data associated with that IP.
Date | Type |
<%= scan.date %> | <%= scan.scanType.name %> |