Method: StandardModel#auto_strip_attributes
- Defined in:
- lib/app/models/concerns/standard_model.rb
#auto_strip_attributes ⇒ Object
Automatically strip any leading or trailing whitespace on model attribute values.
340 341 342 343 344 345 346 347 |
# File 'lib/app/models/concerns/standard_model.rb', line 340 def auto_strip_attributes # Iterate through all attributes and strip those which respond # to the method attribute_names.each do |name| attr = send(name) send("#{name}=", attr.strip) if attr.respond_to?(:strip) end end |