Skip to content

Instantly share code, notes, and snippets.

@deJaVisions
Created February 25, 2012 03:57
Show Gist options
  • Select an option

  • Save deJaVisions/1906315 to your computer and use it in GitHub Desktop.

Select an option

Save deJaVisions/1906315 to your computer and use it in GitHub Desktop.
class Product < ActiveRecord::Base
has_many :materials, :through => :product_materials
has_many :products_material
end
class Material < ActiveRecord::Base
belongs_to :product, :through => :products_material
has_many :products_material
end
class ProductMaterials < ActiveRecord::Base
belongs_to :product
belongs_to :material
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment