Class: Counter::Cache::ActiveRecordUpdater

Inherits:
Struct
  • Object
show all
Defined in:
lib/counter/cache/active_record_updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



3
4
5
# File 'lib/counter/cache/active_record_updater.rb', line 3

def options
  @options
end

Instance Method Details

#after_create(record) ⇒ Object



4
5
6
# File 'lib/counter/cache/active_record_updater.rb', line 4

def after_create(record)
  counter_for(record).update(:incr)
end

#after_destroy(record) ⇒ Object



8
9
10
# File 'lib/counter/cache/active_record_updater.rb', line 8

def after_destroy(record)
  counter_for(record).update(:decr)
end