我有3個表:協會在軌道3個表
Product Purshase Supplier
supplier_id product_id name
這是相關機型:
class Purshase < ActiveRecord::Base
belongs_to :product
end
class Product < ActiveRecord::Base
has_many :supplier
has_many :purshase
end
class Supplier < ActiveRecord::Base
belongs_to :product
end
我想表明這種方式在我看來:purchase.product.supplier.name
我假設'Purshase'和'purshase'確實是'Purchase'和'purchase',對嗎? – Gerry