aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/touch_later.rb
Commit message (Collapse)AuthorAgeFilesLines
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* Use `squish` rather than `strip_heredoc`Ryuta Kamizono2016-07-041-2/+2
|
* Improve error message when record touch fails.Ben Standefer2016-07-021-1/+6
| | | | | | The current error message only indicates that a touch can fail because the record is new. In practice, we saw cases where touches were failing because the record had been destroyed. `persisted?` checks `new_record?` *and* `destroyed?`. It was confusing to get a message about a new record when in reality we were destroying records. I also included a helpful tip for users to consider using `persisted?`, `new_record?`, or `destroyed?` before touching.
* Make sure we touch all the parents when touch_later.Arthur Neves2015-12-061-4/+12
| | | | | | | | | | | | | | | | | | | | The problem was that when saving an object, we would call touch_later on the parent which wont be saved immediteally, and it wont call any callbacks. That was working one level up because we were calling touch, during the touch_later commit phase. However that still didnt solve the problem when you have a 3+ levels of parents to be touched, as calling touch would affect the parent, but it would be too late to run callbacks on its grand-parent. The solution for this, is instead, call touch_later upwards when the first touch_later is called. So we make sure all the timestamps are updated without relying on callbacks. This also removed the hard dependency BelongsTo builder had with the TouchLater module. So we can still have the old behaviour if TouchLater module is not included. [fixes 5f5e6d924973003c105feb711cefdb726f312768] [related #19324]
* Batch touch parent recordsArthur Neves2015-04-081-0/+50
[fixes #18606] Make belongs_to use touch over touch_later when running the callbacks. Add more tests and small method rename Thanks Jeremy for the feedback.