mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
13e7090d40
Summary of changes - Added the following methods to persistence/mongoid_persistence.rb - find_in_state - count_in_state - with_state_scope (protected in AR, would argue it should be made public there. - I did not port calculate_in_state, due to AR vs. Mongoid API differences; I made with_state_scope public instead. (I think it should be public for AR as well.) - Moved AASM::Base patch which aliases scopes in persistence/active_record_persistence.rb to persistence/base.rb, and added a Mongoid detection clause to the if statement (in addition to AR). Also deleted commented code from the original method. - Added 'mongoid' as dev dependency to gemspec - Created two test files (mongoid_persistance_spec.rb and mongoid_models.rb) covering all my changes.
23 lines
No EOL
354 B
Ruby
23 lines
No EOL
354 B
Ruby
class SimpleMongoid
|
|
include Mongoid::Document
|
|
include AASM
|
|
|
|
field :status, type: String
|
|
|
|
aasm_column :status
|
|
aasm_state :unknown_scope
|
|
aasm_state :new
|
|
end
|
|
|
|
class SimpleNewDslMongoid
|
|
include Mongoid::Document
|
|
include AASM
|
|
|
|
field :status, type: String
|
|
|
|
aasm :column => :status
|
|
aasm do
|
|
state :unknown_scope
|
|
state :new
|
|
end
|
|
end |