'Modify updated_at attribute through db trigger in rails
I was wondering if there is anything wrong about updating the updated_at attribute of a record through a db trigger in terms of fragment caching (i.e. the partials dont get re-cached / the old cache keys do not disappear from memory).
additional info I'm using a trigger due to using the upsert gem which does not modify the updated_at attribute unless explicitly told to do so ( which I do not want to do ); also, due to the same gem I cannot use an active::record after_save or before_save on the model.
Please let me know if there any other information I should provide to add some clarity to my question.
Solution 1:[1]
There isn't nothing wrong, but if you need to do so you can simply use record.touch
in a method so your code will be more clean and app will be more maintainable.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Joe |