Hello everyone 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 :invoicedetails has_many :invoices, :through=>:invoicedetails end class Invoicedetail < ActiveRecord::Base belongs_to :item belongs_to :invoice end class Invoice < ActiveRecord::Base has_many :invoicedetails 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---