1. module StripAttributes
  2. def strip_attributes!(*attrs)
  3. attrs.map(&:to_s)
  4. before_validation do |r|
  5. attrs.each do |v|
  6. r[v].strip! if r[v]
  7. end
  8. end
  9. end
  10. end