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

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

Instance Method Summary collapse

Instance Method Details

#attr_protected(*attrs) ⇒ Object



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

def attr_protected(*attrs)
  raise AccessibleOrProtected.new(name) if try(:accessible_attributes?)
  self.protected_attributes = Set.new(attrs) + (protected_attributes || [])
end

#key(*args) ⇒ Object



19
20
21
22
23
# File 'lib/mongo_mapper/plugins/protected.rb', line 19

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