I am new to Ruby-on-Rails I have following tables with below mentioned attributes
Supplier - id ,name,address etc------
Variant - id ,price,etc---
SupplierVariant- supplier_id,variant_id
LineItem - variant_id ,order_id
There is one more table called 'Order' which has line_items as it attribute.Each 'Order' object is linked to variant through lineitems.My requirement is to get all the supplier_ids from a particular order using the join operation between the tables.
I am using 'Spree' to build my application and for the above mentioned question I have tried the following in rails console
ord=Spree::Order.find_by_number("R1218823")
var=ord.line_items.joins(:variant)
till here it's working fine, but when I do var.joins(:SupplierVariant), I am getting error.
Aucun commentaire:
Enregistrer un commentaire