In a Rails 3 app I have the following:
class Kase < ActiveRecord::Base
state_machine :state, :initial => :lead do
state :lead
state :active
state :completed
event :reset_status do
transition any => :lead
end
event :activate do
transition any => :active
end
event :complete do
transition any => :completed
end
end
end
The documentation (https://github.com/pluginaweek/state_machine) shows that the following should be available for my situation:
vehicle.state_paths # => [[#<StateMachine::Transition ...], [#<StateMachine::Transition ...], ...]
vehicle.state_paths.to_states # => [:lead, :active, :completed]
However, when I run the following I get an error:
@kase = Kase.first
@kase.state
=> "lead"
@kase.state_paths
NoMethodError: undefined method `state_paths' for #<Kase:0x00000100d95ca0> ...
I’m trying to get a list of all the possible states for a Kase. What am I missing?
state_paths is not available in a released version of state_machine yet. A new version will be released this week that includes the feature you’re trying to use.