Module CouchRest::Model::PropertyProtection
In: lib/couchrest/model/property_protection.rb

Methods

Classes and Modules

Module CouchRest::Model::PropertyProtection::ClassMethods

Public Class methods

Property protection from mass assignment to CouchRest::Model properties

Protected methods will be removed from

 * new
 * update_attributes
 * upate_attributes_without_saving
 * attributes=

There are two modes of protection

 1) Declare accessible poperties, and assume all unspecified properties are protected
   property :name,  :accessible => true
   property :admin                      # this will be automatically protected

 2) Declare protected properties, and assume all unspecified properties are accessible
   property :name                       # this will not be protected
   property :admin, :protected => true

 3) Mix and match, and assume all unspecified properties are protected.
   property :name,  :accessible => true
   property :admin, :protected  => true # ignored
   property :phone                      # this will be automatically protected

 Note: the timestamps! method protectes the created_at and updated_at properties

Public Instance methods

Return a new copy of the attributes hash with protected attributes removed.

[Validate]