belongs_to behaviour and missing method updated?

Just thinking out loud here…

What about if you changed the parameter to nationality_id instead of nationality. That way, when the constructor is creating the object calls the method nationality_id= which is expecting a integer instead of the the method its currently calling nationality= which is created from the belongs_to declaration.

In either case, your workaround does the trick but this might be a little more efficient.


I was referring to the parameter passed in from the view…

so then your html would look like this:

<%= options_from_collection_for_select(@countries, :id, :name,
@selected) %>

I believe that should work and not require querying the Nationality database.