During my application there are objects, plus they fit in with nations, regions, metropolitan areas, types, groups, companies along with other sets. Every set is quite simple - it's id, title and often some pointers with other sets, also it never changes. Some sets are small , I load them in before_filter like this:

@countries = Country.all
@regions = Region.all

However I call, for instance, offer.country.title or region.country.title and my application works another db query-by-id, although I have already loaded all of them. Next I perform query through :include, which situation ids, produced by eager loading, don't rely on either I have already loaded this data with another query-by-id or otherwise.

And So I want some cache. For instance, I might generate hashes with secrets as records-ids during my before_filter after which call @nations[offer.country_id].title. This situation it appears I do not need eager loading and it is easy switch on Rails.cache here. But maybe there's some wise built-in rails solution that doesn't require to rewrite everything?

Caching lists of models like this will not cache individual cases of which exist in other model's associations.

The Rails team has done applying Identity Maps in Rails 3.1 to resolve this exact problem, but it's disabled automatically for the time being. You are able to enable it and find out whether it works best for your condition.