I have a Tweet
model. I want to update the model attributes but without updating the timestamp.
I've already read/tried some links and didn't work for me:
- How to update a single attribute without touch updated_at attribute?
- http://blog.bigbinary.com/2009/01/21/override-automatic-timestamp-in-activerecord-rails.html
I tried to override ActiveRecord::Base
as mentioned in the second link, by creating a new file active_record_base_patches.rb
inside lib
directory. But, the engine said that the method was not found in Tweet
model.
So, I tried to move the update_record_without_timestamping
to Tweet
model. The method is found now but the timestamp is updated.
Is there any simple method to disable timestamp in Rails for a while? Laravel 4 has something like this: https://stackoverflow.com/a/18906324/3427434.
PS: I use Ruby on Rails 4.2.3 on Ruby 2.2.0.