state_machines-activerecord
state_machines-activerecord copied to clipboard
dynamic approach dont persist on database
Guys, i dont know if this is my mistake or real bug. someone can help me?
When i use dynamic approach, i geting one problem: the state dont persisted on database.
i reproduce the issue in below repo https://github.com/thiagoliof/testFlow tks for all
Hi,
i face the same problem. When using the dynamic approach the state is written to the database but on load the state is always the initial state. Did you find a solution for that?
It looks like if you create an object via new first then call save it will set the initial state and override any other attributes assigned to the unsaved model.
f = Foo.new(name:'bob')
f.save
Will cause 'f' to be saved to the db with name set to nil.
If you do
f = Foo.create(name:'bob')
f.name = "chad"
f.save
It will set name to "chad".