So i'm still trying to get to grips with Ruby & Rails and Postgres and i need to run a query but can't quite get my head round how to return the desired results
i have the following
ORDERS
the orders have many #ITEMS // as well as a TOTAL_PRICE variable
in the #ITEMS is an ORDERABLE_ID variable which refers to a #PRODUCT
i also have
USERS the users have many #ORDERS
I'm trying to run a query that will do the following
Check IF the current USER has an ORDER that contains an ITEM with ORDERABLE_ID == 71 with an ORDER TOTAL_PRICE > 40
OrderItem belongs_to :order
OrderItem belongs_to :orderable
Order has many :items, class_name "OrderItem"