Good notes posted by dmantilla
RSS feed
7 thanks
acts_as_state_machine named scopes
If you are using the acts_as_state_machine plugin, this will generate all named scopes for your various states.
Place it after the acts_as_state_machine and state declarations.
class Task < ActiveRecord::Base acts_as_state_machine :initial => :waiting state :waiting state :running state :finished states.each { |s| named_scope s, :conditions => { :state => s.to_s } } end
Then doing a Task.waiting will return the corresponding tasks.

15 thanks
Link to caller URL
link_to “Back”, :back