Skip to content

Instantly share code, notes, and snippets.

@nettofarah
Created November 17, 2015 18:40
Show Gist options
  • Save nettofarah/98eee90773de577c3e55 to your computer and use it in GitHub Desktop.
Save nettofarah/98eee90773de577c3e55 to your computer and use it in GitHub Desktop.
class Chef < ActiveRecord::Base
has_many :recipes
has_many :ingredients, through: :recipes
end
class Recipe < ActiveRecord::Base
has_many :recipes_ingredients
has_many :ingredients, through: :recipes_ingredients
end
class Ingredient < ActiveRecord::Base
end
class RecipesIngredient < ActiveRecord::Base
belongs_to :recipe
belongs_to :ingredient
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment