Skip to content

Instantly share code, notes, and snippets.

@lorenzosinisi
Created June 2, 2015 08:01
Show Gist options
  • Save lorenzosinisi/cf95d9facaf787113b11 to your computer and use it in GitHub Desktop.
Save lorenzosinisi/cf95d9facaf787113b11 to your computer and use it in GitHub Desktop.
Useful scopes for MicroServices in Ruby on Rails
scope :to_do, lambda { where(:processed => false) }
scope :processed, lambda { where(:processed => true) }
scope :to_do_now, lambda { where("due_date > ? AND due_date < ?", DateTime.now, DateTime.now + 3.minutes) }
scope :not_processed, lambda { where(:processed => false) }
scope :circular, lambda { where("minutes IS NOT NULL") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment