Module: ActiveModelCachers::Hook::Associations

Defined in:
lib/active_model_cachers/hook/associations.rb

Instance Method Summary collapse

Instance Method Details

#delete_count(method, scope) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/active_model_cachers/hook/associations.rb', line 8

def delete_count(method, scope)
  if method == :delete_all
    # TODO:
  else # nullify
    call_hooks{ scope.pluck(:id) }
  end
  super
end

#delete_records(records, method) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/active_model_cachers/hook/associations.rb', line 17

def delete_records(records, method)
  case method
  when :destroy
  when :delete_all
    # TODO:
  else
    call_hooks{ records.map(&:id) }
  end
  super
end