Undefined method updated? for <model object>

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

Could you provide the error trace?

Cheers,
Nicholas

Himanshu P. wrote:

Hi,
I have two model say-

ZipCode < ActiveRecord::Base
belongs_to :state_provinces
end

I 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
[email protected]

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