Hi, I have two model say- ZipCode < ActiveRecord::Base belongs_to :state_provinces end StateProvince < ActiveRecord::Base has_many :zip_codes end if I do @zip_code.update_atribute(:city, "My City") its giving Undefined method updated? for StateProvince if I remove belongs_to specifier in ZipCode class then it work fine. Any alternate solution?? Thanks -- Regards, Himanshu --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Could you provide the error trace? Cheers, Nicholas On Jul 31, 2:43 am, Himanshu Prakash <vision2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I have two model say- > > ZipCode < ActiveRecord::Base > belongs_to :state_provinces > end > > StateProvince < ActiveRecord::Base > has_many :zip_codes > end > > if I do @zip_code.update_atribute(:city, "My City") > its giving Undefined method updated? for StateProvince > > if I remove belongs_to specifier in ZipCode class then it work fine. > Any alternate solution?? > > Thanks > -- > Regards, > Himanshu
Marnen Laibow-Koser
2009-Aug-02 06:20 UTC
Re: Undefined method updated? for <model object>
Himanshu Prakash wrote:> Hi, > I have two model say- > > ZipCode < ActiveRecord::Base > belongs_to :state_provinces > endI don''t know if this is related to the error you''re having, but belongs_to takes a *singular* model name, so that should be belongs_to :state_province Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/.