Skip to content

Instantly share code, notes, and snippets.

@deJaVisions
Created February 26, 2012 02:32
Show Gist options
  • Select an option

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

Select an option

Save deJaVisions/1912333 to your computer and use it in GitHub Desktop.
class Material < ActiveRecord::Base
has_many :product_materials
has_many :products, :through => :product_materials
#validates :title, presence: true
end
class Product < ActiveRecord::Base
has_many :product_materials
has_many :materials, :through => :product_materials
#validates :title, presence: true
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