Created
April 6, 2012 20:39
-
-
Save dperrymorrow/2322767 to your computer and use it in GitHub Desktop.
defaults on a model
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
#overwite the accessor for a field on a model if empty | |
def start_date | |
self[:start_date] || 1.month.ago.strftime("%Y%m%d") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment