Created
March 4, 2010 11:23
-
-
Save etaque/321632 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
before_validation :clear_empty_attributes | |
protected | |
def clear_empty_attributes | |
attributes.each do |key,value| | |
self[key] = nil if value.is_a?(String) && value.blank? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment