Module: ActiveModel::Validations::HelperMethods
- Defined in:
- lib/strip_attributes.rb
Instance Method Summary collapse
-
#strip_attributes(options = nil) ⇒ Object
Strips whitespace from model fields and converts blank values to nil.
-
#strip_attributes!(options = nil) ⇒ Object
DEPRECATED: Please use
strip_attributes
(non-bang method) instead.
Instance Method Details
#strip_attributes(options = nil) ⇒ 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( = nil) StripAttributes.() before_validation do |record| StripAttributes.strip(record, ) end end |
#strip_attributes!(options = nil) ⇒ Object
DEPRECATED: Please use strip_attributes
(non-bang method) instead.
15 16 17 18 |
# File 'lib/strip_attributes.rb', line 15 def strip_attributes!( = nil) warn "[DEPRECATION] `strip_attributes!` is deprecated. Please use `strip_attributes` (non-bang method) instead." strip_attributes() end |