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

with_state approach #8

Closed pragmaticivan closed 9 years ago

pragmaticivan commented 9 years ago

Hi, I'm trying to migrate my app to use this gem now, I was using with_state of the last gem, did you guys have removed this?

ex:

Coupon.with_state(:active)
Coupon.with_states(:active, :completed)
seuros commented 9 years ago

Is Coupon an ActiveRecord model ?

pragmaticivan commented 9 years ago

Yes @seuros

pragmaticivan commented 9 years ago

If you check on the old gem, you can see on the .methods method that we can use the with_state and without_state approach.

Do I need to use the active record gem ? I though the state_machines gem already check if I'm using Active Record and use this as well.

seuros commented 9 years ago

That part of the activerecord integration : https://github.com/state-machines/state_machines-activerecord. This gem is the core only for POROs.

pragmaticivan commented 9 years ago

Thanks.