Skip to content

Instantly share code, notes, and snippets.

@bbtdev
Created May 29, 2020 15:06
Show Gist options
  • Save bbtdev/72e2601a104123a962c9e96c842c712f to your computer and use it in GitHub Desktop.
Save bbtdev/72e2601a104123a962c9e96c842c712f to your computer and use it in GitHub Desktop.
Ordering::Item.joins(:category)
.where(ordering_categories: {categorizable_type: "Ordering::Special"})
# ^ vezi cum e ordering_categories si nu doar categories, deci fac join la doar categories
Ordering::Category
joins("RIGHT JOIN ordering_specials ON ordering_specials.id = ordering_categories.id")
# join si pun eu fieldul de join
.where("ordering_specials.locked = ?", true)
.where("ordering_specials.menuable_type = ?", "Restaurant")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment