Forum: Ruby on Rails restful_authentication and relation specification

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
57c6a3276ed9cbb3b271e5dd067f0724?d=identicon&s=25 Indu R Nair (indu)
on 2009-03-19 15:05
Hello everyone
Trying to use restful_authentication in my project.
country_id,state_id,city_id is the attributes of the user model. I
specified the relation
has_many :users in in three of the model files and in the user model
file specified as belongs_to :country_id,belongs_to :state_id,belongs_to
:city_id. After that when i tried to save user model error "undefined
method `to_sym' for #<State:0x667b258>" . when I remove the relation I
can save the user model . Where I am going wrong? is it possible to
specify relation ? Pls help.
Thanks in advance.
23ae9e75998020bacd139c7a5da311fc?d=identicon&s=25 David Herman (Guest)
on 2009-03-19 15:28
(Received via mailing list)
the user shouldn't belong to a state, the user should have_one :state

and also your belongs to should be :state not :state_id
57c6a3276ed9cbb3b271e5dd067f0724?d=identicon&s=25 Indu R Nair (indu)
on 2009-03-19 15:52
David Herman wrote:
> the user shouldn't belong to a state, the user should have_one :state
>
> and also your belongs to should be :state not :state_id

Corrected the relation but the problem is existing
This topic is locked and can not be replied to.