Module: SanitizeAttributes::InstanceMethods
- Defined in:
- lib/sanitize_attributes/instance_methods.rb
Instance Method Summary collapse
-
#sanitize! ⇒ Object
sanitize! is the method that is called when a model is saved.
Instance Method Details
#sanitize! ⇒ Object
sanitize! is the method that is called when a model is saved. It can be called to manually sanitize attributes.
6 7 8 9 10 11 |
# File 'lib/sanitize_attributes/instance_methods.rb', line 6 def sanitize! self.class.sanitizable_attributes.each do |attr_name| cleaned_text = process_text_via_sanitization_method(self.send(attr_name), attr_name) self.send((attr_name.to_s + '='), cleaned_text) end end |