Module: ActsAsStrippableOn::Core

Included in:
ActsAsStrippableOn
Defined in:
lib/acts_as_strippable_on/core.rb

Instance Method Summary collapse

Instance Method Details

#acts_as_strippable_on(*attributes) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/acts_as_strippable_on/core.rb', line 3

def acts_as_strippable_on(*attributes)
  before_validation do
    attributes.each do |attribute|
      send(attribute).strip! if send(attribute).present? && send(attribute).respond_to?(:strip!)
    end
  end
end