I think this concept could be argued either way so I am presenting it as a question than an issue. In this trivial example, the class has a method importance. When using the state machine, I expected the importance method to be overridden by the state machine when state == :on, but that does not happen.
Should the state machine override the method when the state applies?
class MyModel
def importance
99
end
state_machine do
state :on do
def importance
1
end
end
state :off do
end
end
end
> m.state = :on
> m.importance
99 <---- expected to be 1, the state machine method is not being used
I think this concept could be argued either way so I am presenting it as a question than an issue. In this trivial example, the class has a method
importance
. When using the state machine, I expected theimportance
method to be overridden by the state machine whenstate == :on
, but that does not happen.Should the state machine override the method when the state applies?
Thank you!