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

Can't access save from after_transition with datamapper #23

Closed neumachen closed 9 years ago

neumachen commented 9 years ago

I am using datamapper as my ORM and have an after_transition method doing a save but getting this error:

NameError: undefined local variable or method `save_customer' for #<StateMachines::Machine:0x007f889dc07da8>

Any help would be great.

seuros commented 9 years ago

The datamapper intergration is not implemented. If you could prepare a sample application with datamapper, i can work in fixing it.

neumachen commented 9 years ago

@seuros if it's ok I would like to do this for exercise. Will you be able to guide me to do it?

rosskevin commented 9 years ago

@magicalbanana here are two existing integrations that you may want to peruse:

https://github.com/state-machines/state_machines-activerecord https://github.com/state-machines/state_machines-mongoid

You can try to do the integration yourself in your own repository. If you get it working (with tests) and would like to contribute it to the state_machines org, please open another issue and we can review it and make a decision to transfer it from you to this org. Thank you