= cache expires_in: 5.minutes do
...
= cache [:catalog, Category.maximum(:updated_at)] do
...
class User < ActiveRecord::Base
has_many :outgoing_messages, class_name: 'Message', inverse_of: :sender
has_many :ingoing_messages, class_name: 'Message', inverse_of: :receiver
class Message < ActiveRecord::Base
belongs_to :sender, class_name: 'User', inverse_of: :outgoing_messages
belongs_to :receiver, class_name: 'User', inverse_of: :ingoing_messages