Module: CouchRest::Model::PropertyProtection
- Extended by:
- ActiveSupport::Concern
- Included in:
- Base
- Defined in:
- lib/couchrest/model/property_protection.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) accessible_properties
- - (Object) protected_properties
-
- (Object) remove_protected_attributes(attributes)
Return a new copy of the attributes hash with protected attributes removed.
Class Method Details
+ (Object) included(base)
31 32 33 |
# File 'lib/couchrest/model/property_protection.rb', line 31 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
- (Object) accessible_properties
50 51 52 |
# File 'lib/couchrest/model/property_protection.rb', line 50 def accessible_properties self.class.accessible_properties end |
- (Object) protected_properties
54 55 56 |
# File 'lib/couchrest/model/property_protection.rb', line 54 def protected_properties self.class.protected_properties end |
- (Object) remove_protected_attributes(attributes)
Return a new copy of the attributes hash with protected attributes removed.
60 61 62 63 64 65 66 67 |
# File 'lib/couchrest/model/property_protection.rb', line 60 def remove_protected_attributes(attributes) protected_names = protected_properties.map { |prop| prop.name } return attributes if protected_names.empty? or attributes.nil? attributes.reject do |property_name, property_value| protected_names.include?(property_name.to_s) end end |