Module: PropertySets::ActiveRecordExtension::InstanceMethods
- Defined in:
- lib/property_sets/active_record_extension.rb
Class Method Summary collapse
Instance Method Summary collapse
- #update_attributes_with_property_sets(attributes) ⇒ Object
- #update_attributes_with_property_sets!(attributes) ⇒ Object
- #update_property_set_attributes(attributes) ⇒ Object
Class Method Details
.included(base) ⇒ Object
92 93 94 95 |
# File 'lib/property_sets/active_record_extension.rb', line 92 def self.included(base) base.alias_method_chain :update_attributes, :property_sets base.alias_method_chain :update_attributes!, :property_sets end |
Instance Method Details
#update_attributes_with_property_sets(attributes) ⇒ Object
97 98 99 100 |
# File 'lib/property_sets/active_record_extension.rb', line 97 def update_attributes_with_property_sets(attributes) update_property_set_attributes(attributes) update_attributes_without_property_sets(attributes) end |
#update_attributes_with_property_sets!(attributes) ⇒ Object
102 103 104 105 |
# File 'lib/property_sets/active_record_extension.rb', line 102 def update_attributes_with_property_sets!(attributes) update_property_set_attributes(attributes) update_attributes_without_property_sets!(attributes) end |
#update_property_set_attributes(attributes) ⇒ Object
107 108 109 110 111 112 113 114 115 |
# File 'lib/property_sets/active_record_extension.rb', line 107 def update_property_set_attributes(attributes) if attributes && self.class.property_set_index.any? self.class.property_set_index.each do |property_set| if property_set_hash = attributes.delete(property_set) send(property_set).set(property_set_hash, true) end end end end |