state_machine: Initial state doesn't work in Rails 4.2
Hi, I have problem with initial state in new Rails 4.2
class User < ActiveRecord::Base
state_machine initial: :waiting_confirmation do
state :waiting_confirmation
state :active
end
end
Loading development environment (Rails 4.2.0)
[1] pry(main)> User.new.state
=> nil
Any ideas?
About this issue
- Original URL
- State: open
- Created 10 years ago
- Comments: 26
@kalashnikovisme https://github.com/state-machines/state_machines-activerecord
@mkonikowski @shlima @khaleksa This repo is not supported. Development moved to: https://github.com/state-machines/state_machines-activerecord
I use https://github.com/seuros/state_machine with Rails 4.2
everything work now
Guys, just use state_machines-activerecord.
I got the same problem too, i’m using this (for now) (in your model where :draft is initial)