state-machines / state_machines

Adds support for creating state machines for attributes on any Ruby class
https://github.com/state-machines/state_machines
MIT License
814 stars 91 forks source link

dynamic + ActiveRecord #40

Closed thiagoliof closed 7 years ago

thiagoliof commented 8 years ago

Guys, im tryng implement one dynamic state machive, but i dont kown where i making mistake. im following this approach https://github.com/state-machines/state_machines#static--dynamic-definitions but the state dont saved in DB. I can retrieve state on the fly only using by console, but if i close terminal session and open another session, the state always set :initial and DB Column is Nil someone can help me?

im using Rails 4.2.4 and Ruby 2.1.1

seuros commented 8 years ago

You probably need to use state_machines-activerecord

thiagoliof commented 8 years ago

my gem file has gem 'state_machines-activerecord'

if i remove dymamic approach it is ok, but if i use dymamic way the data "initial" (or any event ) it is not persisted on database. i dont know where i making mistake

PS: i'm using the rails console to try this!

seuros commented 8 years ago

let open this issue in the other repo. could you provide a sample app ?

thiagoliof commented 8 years ago

Ok @seuros i reproduce the issue in below repo https://github.com/thiagoliof/testFlow tks for all