Module: LoyalCore::ActiveModel::ClassMethods

Defined in:
lib/loyal_core/active_model/strip_whitespace.rb

Instance Method Summary collapse

Instance Method Details

#strip_whitespace_before_validation(*args) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/loyal_core/active_model/strip_whitespace.rb', line 14

def strip_whitespace_before_validation *args
  options = args.extract_options!

  before_validation do |r|
    args.each do |field|
      self.send :"#{field}=", self.send(field).to_s.strip
    end
  end
end