Got bit by this again. So, for the record …

If you’re selects are’t working (i.e. you’ve got and ID coming through but it is’t showing in a select box).

Check your types

I had:

 @admin.introducer_id = admin_args[:introducer_id]

and this in the rhtml:

 <% form_for(:admin, @admin, :url => admin_path(“index”), :id => ‘admi’ ) do |f| >
    <
= f.select :introducer_id, @introducer_list, {}, {:onChange => ‘go()’ }%>
<%end%>

The it just was’t working no matter what I did.

Then I noticed that a select that was a list of strings was … so … 

 @admin.introducer_id = admin_args[:introducer_id].to_i

and it started working. This has happened to me before – I had a lookup table that stored the lookup ID in a string (‘cos it could have been a string as well as an ID) and it did’t work then. Stupid, stupid boy. Ruby does’t coerce stuff.

Hope this helps the next person.