Method: Counter::Definition.count

Defined in:
lib/counter/definition.rb

.count(association_name, as: "#{association_name}_counter") ⇒ Object

Set the association we’re counting



105
106
107
108
109
110
# File 'lib/counter/definition.rb', line 105

def self.count association_name, as: "#{association_name}_counter"
  instance.association_name = association_name
  instance.name = as.to_s
  # How the counter can be accessed e.g. counter.products_counter
  instance.method_name = as.to_s
end