Skip to content

Instantly share code, notes, and snippets.

@manlycode
Created April 8, 2014 14:50
Show Gist options
  • Save manlycode/10136687 to your computer and use it in GitHub Desktop.
Save manlycode/10136687 to your computer and use it in GitHub Desktop.
def initialize(order, seller)
@order = order
if seller.is_a?(User)
@items = order.items.select("order_items.*").joins(:product).where('products.organization_id' => seller.organization_ids)
elsif seller.is_a?(Organization)
@items = order.items.select("order_items.*").joins(:product).where('products.organization_id' => seller.id)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment