Automatically add accessible_by to Mongoid Documents to match CanCan behavior for ActiveRecord and DataMapper.
Previously, CanCan::ModelAdditions had to be included in each and every Mongoid document separately. Also removed manual include of CanCan::ModelAdditions from Mongoid documents in Mongoid adapter specs.
This commit is contained in:
@@ -51,3 +51,8 @@ module CanCan
|
||||
alias_method :matches_conditions_hash?, :matches_conditions_hash_with_mongoid_subject?
|
||||
end
|
||||
end
|
||||
|
||||
# simplest way to add `accessible_by` to all Mongoid Documents
|
||||
module Mongoid::Document::ClassMethods
|
||||
include CanCan::ModelAdditions::ClassMethods
|
||||
end
|
||||
Reference in New Issue
Block a user