Pull #6986 causes a backward-incompatible change in behavior in Rails version 3.2.9.
I have two issues with this pull request:
Here is an example test that passes in version 3.2.8 but fails in 3.2.9:
class Parent < ActiveRecord::Base
class Child < ActiveRecord::Base
belongs_to :parent, :touch => true
@parent = Parent.create
Child.create(:parent => @parent)
key = @parent.cache_key
assert_not_equal key, @parent.cache_key # F
In version 3.2.8, this test passed because it only required a fraction of a second to pass between when the parent was created an touched.
The only way I can make this test pass in version 3.2.9 (without monkey patching) is by adding sleep 1 before @object.child.touch.
This is also an issue in master and should be fixed before the 4.0.0 and backported to 3-2-stable.
Add a regression test on #8195
@rafaelfranca I've failed to reproduce this particular cache_key issue in master. Also this problem seems not to be related to #6986. It was fixed in #6376 and can be safely backported.
I've submitted a PR with a regression test #8201. Ping me back if I should backport this PRs (#8201, #6376) too 🍺
@nikitug you are right. Thank you to take a look on it.
@sferik could you test your application against this branch? https://github.com/rafaelfranca/rails/tree/3-2-stable-fix
@rafaelfranca I'm still getting those errors when I run my tests against your branch.
I added the test as specified by @sferik . It add some models that are likely quite redundant.
Added regression test for #8195.
@sferik I just merged the @jacobstr tests and reverted the commit added in #6986 and the tests are still failing. So the cause is other. I'm trying to track down and solve it.
Sorry for the delay.
@sferik just testes in 3-2-stable, got the @jacobstr commit and the tests was failing. Cherry picked #6376 and the tests are passing.
Are you sure your tests are not passing in this branch. I still can't reproduce your issue. Could you give me more details?
Not sure why it wasn't working earlier but my tests do seem to be passing now. Thanks for fixing this.
Is this issue resolved?
@parndt need some work from my part, but yes, it is. I'll close when push my commits.
Make sure the tests pass in the case closer to described in #8195
Allow users to choose the timestamp format in the cache key
This can be done using the class attribute cache_timestamp_format