Created
April 13, 2015 17:29
-
-
Save aarkerio/a4a94e141bb0852cb4f9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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