Open danmaz74 opened 10 years ago
vehicle.seatbelt = 'off'
=> vehicle.update_attribute(:seatbelt , 'off')
if you using activerecord.
The gem is for general use so it won't save the object
That's ok for me, but the docs should be updated then. They're very misleading now.
The docs are not important for now. The whole gem is not maintained and is incompatible with new version of rails or mongodb for example.
Is this what you mean pluginaweek/state_machine#291?
@seuros Stating that the "docs are not important for now" is a rather bold statement, considering the fact that this project has been starred more than 3000 times (i.e. lots of people are using this gem) and that the readme (wrongly) states that this gem supports the latest version of rails. Indeed, quoting the readme:
ORM versions officially supported and tested: ActiveModel integration: 3.0.0 or later ActiveRecord integration: 2.0.0 or later
I'm currently on a project using this state_machine
gem and I am having issues with the after_transition
callback. But only now (reading that thread – rather than the readme), I understand that the gem is not expected to work with the latest version of rails.
Suggestion: I think the project's readme should make it clear.
The docs for ActiveRecord show this:
after_transition any => :parked do |vehicle, transition| vehicle.seatbelt = 'off' end
I would then expect that the new value for vehicle.seatbelt would be saved to the database. But this doesn't happen (state_machine v. 1.2, rails v. 3.2.15): the attribute is changed, but if I reload from the DB, it goes back to the old value.
On the contrary, the new value gets saved in a before_transition.
Is this a bug, or just something that should be clarified in the documentation?