Last active
December 19, 2015 13:09
-
-
Save gkilmain/5960028 to your computer and use it in GitHub Desktop.
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
before_save :set_expiration_date #once its been saved update the expires_at attribute with the set_expiration_method | |
def expired? | |
if accepted! #if an offer has been accepted it cannot expire | |
return false | |
else | |
created_at > expires_at #if created_at is greater than expires_at return true, else return false | |
end | |
end | |
def set_expiration_date | |
self.update_attribues(:expires_at => created_at + 6.months) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment