In Rails 5, you can turn cache versioning on and override #cache_version in your model if you'd like to return a different column.
https://github.com/rails/rails/blob/b2eb1d1c55a59fee1e6c4cba7030d8ceb524267c/activerecord/lib/active_record/integration.rb In earlier versions of Rails, you can pass different column names to #cache_key, e.g., model.cache_key(:last_modified). In either case, you can probably just override #cache_key in the model. On Saturday, September 1, 2018 at 12:38:53 PM UTC-5, SeongHoon Ryu wrote: > > I want to cache with custom cache_key of Fragment Caching because I don't > want to change updated_at. > > > So, I googled and found monkeypatch( > https://gist.github.com/tispratik/9276110). But It just a monkey patch. > > > Is there a way to set custom cache_key? > > Thanks > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ad662458-cfc1-4363-9e03-0b27d81c4943%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

