I am very much confused about specifying the relation in the following
one. I had Item, Invoice, Invoicedetail model.
Item table contains - id and name,unit_price fields.
Invoice table contains - id, invoice_number and date
Invoicedetails - invoice_id, item_id, quantity, unit_price fields.
I had mentioned the following relations.
class Item < ActiveRecord::Base
has_many :invoices, :through=>:invoicedetails
class Invoicedetail < ActiveRecord::Base
class Invoice < ActiveRecord::Base
has_many :items, :through=>:invoicedetails
May anyone suggest I am specifying the correct relation or not? If it is
wrong please give correct one and suggestions for understanding the
specification of relations more.
Thanks in advance