Module: LetMeMassAssignProtectedAttributes
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/let_me_mass_assign_protected_attributes.rb,
lib/let_me_mass_assign_protected_attributes/version.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #unprotected_attributes=(attributes) ⇒ Object
-
#unprotected_update_attributes(attributes) ⇒ Object
update_attributes doesn’t set attributes protected via attr_protected (instead, it logs a warning informing you that you are trying to mass-assign protected attributes), so this method is convenient if you have a hash of protected attributes that you want to set.
-
#unprotected_update_attributes!(attributes) ⇒ Object
Updates an object just like Base.unprotected_update_attributes but calls save! instead of save so an exception is raised if the record is invalid.
Class Method Details
.version ⇒ Object
2 3 4 |
# File 'lib/let_me_mass_assign_protected_attributes/version.rb', line 2 def self.version "0.0.3" end |
Instance Method Details
#unprotected_attributes=(attributes) ⇒ Object
6 7 8 |
# File 'lib/let_me_mass_assign_protected_attributes.rb', line 6 def unprotected_attributes=(attributes) assign_attributes(attributes, without_protection: true) end |
#unprotected_update_attributes(attributes) ⇒ Object
update_attributes doesn’t set attributes protected via attr_protected (instead, it logs a warning informing you that you are trying to mass-assign protected attributes), so this method is convenient if you have a hash of protected attributes that you want to set
11 12 13 |
# File 'lib/let_me_mass_assign_protected_attributes.rb', line 11 def unprotected_update_attributes(attributes) update_attributes(attributes, without_protection: true) end |
#unprotected_update_attributes!(attributes) ⇒ Object
Updates an object just like Base.unprotected_update_attributes but calls save! instead of save so an exception is raised if the record is invalid.
16 17 18 |
# File 'lib/let_me_mass_assign_protected_attributes.rb', line 16 def unprotected_update_attributes!(attributes) update_attributes!(attributes, without_protection: true) end |