I am looking for a way to cache the number of each state. I have done counter caching before, but is there a way to create multiple counter_cache columns for each state and keep them updated or should I look elsewhere for caching these values.
aasm_column :state
aasm_initial_state :unopened
aasm_state :unopened
aasm_state :contacted
aasm_state :closed
aasm_event :contact do
transitions :to => :contacted, :from => [:unopened]
end
aasm_event :close do
transitions :to => :closed, :from => [:contacted]
end
It seems like it would just be 3 columns in the database. Any ideas?