Sam, I am assuming you have the following...
class Salesperson < ActiveRecord::Base
has_many :purchased_products, :through => :customers
class Customer < ActiveRecord::Base
class PurchasedProduct < ActiveRecord::Base
table "purchased_products" with "customer_id"
table "customers" with "salesperson_id"
And what you do is:
This works as advertised. I've just tried id. Do you get an error in
Or did you just not get the results you expected?
I ask, because your model is flawed as it only allows each Product to
be purchased by ONE customer only. Same goes for Customers and
Salespeople. Each Customer belongs to only ONE Salesperson.
Did you mean to us has_and_belongs_to_many in these occasions? Or
even a "Customer has_many :products, :through => :purchases" and
"Salesperson has_many :customers, :through => :sales" and utilise the
two join models Purchases, Sales?