Simple search form - ruby newbie

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:

..........
Please select the item(s) to search on.
<%= form_tag :controller => 'ip_address', :action => 'get_data', :id => "@result" %>

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.

<% @result.each do |scan| %> <% end %>
Date Type
<%= scan.date %> <%= scan.scanType.name %>

Its not really clear what the relationship is between IpAddresses and
Scans. Depending on that, using

@scans = IpAddress.find_by_ip(params[:query]).scans

may give you what you want.