Module: MongoMapper::Plugins::Protected::ClassMethods

Defined in:
lib/mongo_mapper/plugins/protected.rb

Instance Method Summary collapse

Instance Method Details

#attr_protected(*attrs) ⇒ Object



6
7
8
# File 'lib/mongo_mapper/plugins/protected.rb', line 6

def attr_protected(*attrs)
  self.write_inheritable_attribute(:attr_protected, Set.new(attrs) + (protected_attributes || []))
end

#key(*args) ⇒ Object



14
15
16
17
18
# File 'lib/mongo_mapper/plugins/protected.rb', line 14

def key(*args)
  key = super
  attr_protected key.name.to_sym if key.options[:protected]
  key
end

#protected_attributesObject



10
11
12
# File 'lib/mongo_mapper/plugins/protected.rb', line 10

def protected_attributes
  self.read_inheritable_attribute(:attr_protected)
end