1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

6 commits

Author SHA1 Message Date
Fumiaki MATSUSHIMA
f4e3eca90c travel back 2015-12-13 11:34:40 +09:00
Arthur Neves
e7c48db509 Make sure we touch all the parents when touch_later.
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 5f5e6d9249]
[related #19324]
2015-12-06 16:53:00 -05:00
Sean Griffin
05436172db Don't rely on subsecond precision being applied in tests
When I originally reviewed the #20317, I believe these changes were
present, but it appears that it was later updated so that they were
removed. Since Travis hadn't re-run the build, this slipped through.
2015-09-23 09:33:43 -06:00
Yves Senn
48a183ecb9 use assert_not instead of refute as mentioned in our guides.
As described in the "Follow Coding Conventions" section in our
contribution guide (http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#follow-the-coding-conventions)
we favor `assert_not` over `refute`.

While we don't usually make stylistic changes on it's own I opted to do
it in this case. The reason being that test cases are usually copied as
a starting point for new tests. This results in a spread of `refute` in
files that have been using it already.
2015-08-13 09:20:39 +02:00
David Heinemeier Hansson
5f5e6d9249 Add pending test for the great-grandparent touching bug from #19324 2015-06-25 14:23:06 +02:00
Arthur Neves
8971389783
Batch touch parent records
[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.
2015-04-08 13:31:28 -04:00