My association to models as follows
People model
belongs_to :category
has_one :account, :through => :category
category model
belongs_to :account
has_many :bookings
acc开发者_开发技巧ount model
has_many :categories
Level model
accepts_nested_attributes :peoples
I wrote
@level.update_attributes(params[:level])
in Level controller.
Here when I update the level model then it also updates the updated_at flag in account_model. I want to avoid the update happen in account model i.e, avoid setting up updated_at flag in account model. how can I avoid this?
I used to do something like this:
Account.record_timestamps = false
level.save
Account.record_timestamps = true
You can make it look prettier by creating a wrapper method which will receive a block to execute without timestamps.
精彩评论