New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache key behaviour for alliased timestamps #26417
Comments
Shouldn't it be |
In this case the |
There is also a subtle difference in behavior for this method that is annoying. Supposedly I work around my issue by writing this:
When modified_date is nil it will throw an exception. But
When updated_at is nil does not fail it returns a cache key with the id only. I will expect to have have the same behavior for nil modified_date. |
Can you please post what exception you got? |
It will be a nil exception on this line
|
Given the surrounding conditionals, the nil exception definitely sounds like a bug. Can you reproduce the alias-ignoring behaviour on 5.0 or master? I think it might be fixed there. |
Opened #26425 to fix the issue of getting an error when named timestamp column has value |
- When the named timestamp column is nil, we should just return the cache_key with model name and id similar to the behavior of implicit timestamp columns. - Fixed one of the issue mentioned in rails#26417.
Found out that the issue related to aliased attribute exists on master as well. Reproduction script here - https://gist.github.com/prathamesh-sonpatki/1c82c0a86d1ca171b086324d41af8491 I fixed it here - prathamesh-sonpatki@78c8235 but would like to get some feedback cc @sgrif @matthewd Also should we fix this issue for |
…re reading - If aliased, then use the aliased attribute name. - Fixes rails#26417.
Steps to reproduce
I a simple model
Expected behavior
It should respect the defined alias and include the modified_date into the cache_key
Actual behavior
It does not include the modified_date
System configuration
Rails 4.2.7.1
Ruby 2.3.0
The text was updated successfully, but these errors were encountered: