Skip to content

Instantly share code, notes, and snippets.

@jimdalbano
Forked from gkilmain/expires_at method
Created July 9, 2013 18:49
Show Gist options
  • Save jimdalbano/5960094 to your computer and use it in GitHub Desktop.
Save jimdalbano/5960094 to your computer and use it in GitHub Desktop.
after_save :expires_at #once its been saved update the expires_at attribute
def expired?
if accepted! #if an offer has been accepted it cannot expire
return false
else
created_at < expires_at ? false : true #if created_at is less than expires_at return false, else return true
end
end
def 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