Skip to content

Instantly share code, notes, and snippets.

@aarkerio
Created April 13, 2015 17:29
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 aarkerio/a4a94e141bb0852cb4f9 to your computer and use it in GitHub Desktop.
Save aarkerio/a4a94e141bb0852cb4f9 to your computer and use it in GitHub Desktop.
#
# I need to know if one product in the purchased "order_list" has an 'Event' product_type
# The models: order_list table belongs_to order_items and order_items belongs_to products
#
def has_event?(order_list)
order_list.order_items.each do |oi|
oi.product.each do |product|
return true if product.product_type == 'Event'
end
end
false
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment