Skip to content

Instantly share code, notes, and snippets.

@dereklucas
Created March 2, 2016 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dereklucas/9967b18b69150c7604d8 to your computer and use it in GitHub Desktop.
Save dereklucas/9967b18b69150c7604d8 to your computer and use it in GitHub Desktop.
scope :approved_for_slideshow, ->{
includes(:promo).
where('promos.show_in_slideshow is not false').
where('approved_for_slideshow_at is not null')
}
----- vs -----
scope :approved_for_slideshow, ->{
where('approved_for_slideshow_at is not null')
}
scope :including_slideshow_promos, ->{
includes(:promo).
where('promos.show_in_slideshow is not false')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment