lib/preformatter.rb in preformatter-0.5.1 vs lib/preformatter.rb in preformatter-0.7.0
- old
+ new
@@ -63,9 +63,19 @@
end
end
end
end
+ def remove_extra_white_spaces(*args)
+ args.each do |field|
+ before_validation do |record|
+ attribute = record.send("#{field.to_s}")
+ attribute = attribute.strip.gsub(/[ ]+/, ' ') unless attribute.nil?
+ attribute
+ end
+ end
+ end
+
end
end
\ No newline at end of file