-
Notifications
You must be signed in to change notification settings - Fork 521
Open
Description
State Machines in inherited classes cannot be overriden in child classes.
See following example:
class TestModel
attr_accessor :state
state_machine :initial => :parked do
event :ignite do
transition :parked => :idling
end
before_transition :parked => :idling do |m|
puts "hihihi"
end
end
end
class TestModel2 < TestModel
state_machine :initial => :parked do
event :ignite do
transition :parked => :idling
end
before_transition :parked => :idling do |m|
puts "asdasdasd"
end
end
end
1.9.3p392 :001 > a = TestModel.new
=> #<TestModel:0x007f81751eb768 @state="parked">
1.9.3p392 :002 > a.ignite
hihihi
=> true
1.9.3p392 :003 > a = TestModel2.new
=> #<TestModel2:0x007f817529bcf8 @state="parked">
1.9.3p392 :004 > a.ignite
hihihi
asdasdasd
=> true
1.9.3p392 :005 >
```ruby
As you can see the "hihihi" output is wrong. We should only see "asdasdasd"...Metadata
Metadata
Assignees
Labels
No labels