Forum: Ruby on Rails Problem with foreign key

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ali F. (Guest)
on 2008-12-02 15:30

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 topic is locked and can not be replied to.