我有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