Module: Nomo::Model

Extended by:
ActiveSupport::Concern
Defined in:
lib/nomo/model.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#cache_keyObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nomo/model.rb', line 21

def cache_key
  case
  when new_record?
    "#{self.class.model_name.cache_key}/new"
  when timestamp = self[:updated_at]
    timestamp = timestamp.to_f
    "#{self.class.model_name.cache_key}/#{id}-#{timestamp}"
  else
    "#{self.class.model_name.cache_key}/#{id}"
  end
end

#destroyObject



16
17
18
19
# File 'lib/nomo/model.rb', line 16

def destroy
  Nomo.multi
  super
end

#saveObject



11
12
13
14
# File 'lib/nomo/model.rb', line 11

def save(*)
  Nomo.multi
  super
end