Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoid initial value not setted #206

Closed
nofxx opened this issue Jan 23, 2015 · 5 comments
Closed

Mongoid initial value not setted #206

nofxx opened this issue Jan 23, 2015 · 5 comments
Assignees
Labels

Comments

@nofxx
Copy link

nofxx commented Jan 23, 2015

Won't work.

class Note
  include Mongoid::Document
  include Mongoid::Timestamps
  include AASM

  field :aasm_state, type: String
  aasm do
    state :queued, initial: true
  end
end

Note.new.aasm_state # => nil
Note.new.queued? # => nil

Tryed custom column: 'state' with same error.

Workaround: field :aasm_state, type: String, default: :queued

PS.: Thank you for AASM, hard to find, bad searches engines...the plural... a SEO improvement might be having the singular 'state machine' somewhere.

@nofxx
Copy link
Author

nofxx commented Jan 23, 2015

Willing to accept a patch that creates the field automagically?

@alto alto self-assigned this Jan 26, 2015
@alto alto added the bug label Jan 26, 2015
@alto
Copy link
Member

alto commented Jan 26, 2015

@nofxx Absolutely! I'm happy to accept patches (with tests).

@alto
Copy link
Member

alto commented Feb 23, 2015

Thanks to @Shwetakale this has been fixed. 👍

I will release a new version soon.

@alto alto closed this as completed Feb 23, 2015
@alto
Copy link
Member

alto commented Feb 23, 2015

I just released version 4.1.0 including the changes.

@Shwetakale
Copy link
Contributor

@alto Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants