Return value from collection_select


#1

OK, i have a simple collection_select problem and I’m a newbie to
ruby… I have a form that the user will select a bunch of stuff on to
search through a database.

I can’t figure out how to get the return value out of a
collection_select. Here is the code that displays a drop-down list of
all ip addresses from a table - this works fine. I make my selection
(along with others on the form) and want the result from this
collection_select assigned to the value ipaddr.

@ipAddress.find_all
collection_select (“IpAddress”, “ip”, @ipaddress, :id, “ip”) ** this
works fine, everthing displays

In my controller, I do:
@ipaddr = params[:ip]

This is obviously wrong as I get an error saying "Select * from
ip_addresses where (ip_addresses.ip is NULL) ???

If I use a text input box with the following code, everything works
fine, so I’m pretty sure the controller code is ok - just don’t know how
to get the result code from collection_select.

<input type="text" name="ipaddr">   ** this works, but I don't want

the user to have to type the IP address in - I want them all displayed
to choose from. Thanks.