Problem with foreign key


I’ve a “User” model. A user, belongs to a state model.

I’ve the following in the user form:

    <%=, State.find(:all).map {|c| [,]},{:prompt => "Select a canton"}, {:onchange =>
"#{remote_function(:url  => {:action => "update_municipals"},
                                                       :with =>
"'name='+value")}"}) %>

However when I add a user, it’s “state_id” is null, but if rename
state_id to “state”, the id number of the state is saved correctly.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs