Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Feb 27th, 2012  |  syntax: None  |  size: 0.18 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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