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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Mar 19, 10:05 am, Indu RS <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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_idCorrected the relation but the problem is existing -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---