Module: ActiveModel::Validations::HelperMethods
- Defined in:
- lib/strip_attributes.rb
Instance Method Summary collapse
-
#strip_attributes(options = {}) ⇒ Object
Strips whitespace from model fields and converts blank values to nil.
Instance Method Details
#strip_attributes(options = {}) ⇒ Object
Strips whitespace from model fields and converts blank values to nil.
5 6 7 8 9 10 11 |
# File 'lib/strip_attributes.rb', line 5 def strip_attributes( = {}) StripAttributes.() before_validation(.slice(:if, :unless)) do |record| StripAttributes.strip(record, ) end end |