Skip to content

Instantly share code, notes, and snippets.

@dnch
Created October 25, 2013 04:39
Show Gist options
  • Save dnch/7149498 to your computer and use it in GitHub Desktop.
Save dnch/7149498 to your computer and use it in GitHub Desktop.
# suffers the obvious problem that Time.now is evaluated at load, not on-call...
def prior_to(issue_date = Time.now)
where("issue_date < ?", issue_date).order(:issue_date).reverse_order
end
@foucist
Copy link

foucist commented Oct 25, 2013

prior_to(issue_date)
issue_date ||= Time.now
..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment