Class: ActiveRecord::Base

Inherits:
Object show all
Defined in:
lib/freighthopper/activerecord/element_id.rb,
lib/freighthopper/activerecord/cache_key.rb

Instance Method Summary collapse

Instance Method Details

#cache_keyObject



3
4
5
6
7
8
# File 'lib/freighthopper/activerecord/cache_key.rb', line 3

def cache_key
  [ self.class.to_s.underscore, to_param,
    ( soft_send(:cached_at).try(:to_i) ||
      soft_send(:updated_at).try(:to_i) )
  ].compact.join "/"
end

#element_idObject



3
4
5
# File 'lib/freighthopper/activerecord/element_id.rb', line 3

def element_id
  "#{self.class.to_s.underscore}_#{self.to_param}"
end