module StripAttributes def strip_attributes!(*attrs) attrs.map(&:to_s) before_validation do |r| attrs.each do |v| r[v].strip! if r[v] end end end end