I have set up a cache in my model like
def self.latest(shop_id)
Inventory.where(:shop_id => shop_id).order(:updated_at).last
end
and in my view
<% cache ['inventories', Inventory.latest(session[:shop_id])] do %>
<% @inventories.each do |inventory| %>
<% cache ['entry', inventory] do %>
<li><%= link_to inventory.item_name, inventory %></li>
So, here I can have many shops, each with an inventory of stock items. Will the above cache work at all for different shops?
I think it's possible that even displaying the view in a different shop will break the cache. Or, any shop adding an inventory item will break the cache.
Can I use Russian Doll caching like this or do I need to use Inventory.all in my model?