Skip to content

mongoid - scope by state should query by state_column field #31

@lucasrenan

Description

@lucasrenan

this problem occurs when change the default state column field ("state") and tries to query by state name

stateflow do
    state_column :status
    initial :draft

    state :draft
    state :published
end

MyModel.published

=> #<Mongoid::Criteria
  selector: {:state=>"published"},
  options:  {},
  class:    Dealer,
  embedded: false>

https://github.com/lucasrenan/stateflow/blob/master/lib/stateflow/persistence/mongoid.rb#L12

I'm planning to send a pull request soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions