Created
May 24, 2015 05:38
-
-
Save artificemm/deda549c857fb95ab222 to your computer and use it in GitHub Desktop.
I hate UPCASE data on the DB, so I made this to prevent it
This file contains 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
#I hate UPCASE data on the DB, so I made this to prevent it | |
before_save :titleize_fields | |
def titleize_fields | |
['name', 'paternal_lastname', 'maternal_lastname', 'spouse'].each do |m| | |
self.send("#{m}=", instance_eval(%Q{#{m}.titleize unless #{m}.nil?})) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment