lib/canard/user_model.rb in canard-0.4.0.pre vs lib/canard/user_model.rb in canard-0.4.0

- old
+ new

@@ -57,12 +57,18 @@ # # returns all the users who don't have the manager role. def acts_as_user(*args) include RoleModel include InstanceMethods - extend Adapters::ActiveRecord if defined?(ActiveRecord) && self < ActiveRecord::Base - + options = args.last.is_a?(Hash) ? args.pop : {} + + if defined?(ActiveRecord) && self < ActiveRecord::Base + extend Adapters::ActiveRecord + elsif defined?(Mongoid) && self.included_modules.include?(Mongoid::Document) + extend Adapters::Mongoid + field (options[:roles_mask] || :roles_mask), :type => Integer + end roles_attribute options[:roles_mask] if options.has_key?(:roles_mask) roles options[:roles] if options.has_key?(:roles) && has_roles_mask_accessors?