Created
August 28, 2015 19:24
-
-
Save jmdeldin/f355529f3f7f00d9d449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module StringStripper | |
def strip(*keys) | |
before_validation do | |
keys.each do |k| | |
self[k] = self[k].to_s.gsub(/[[:space:]]/, '') if self[k].present? | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment