Guest User

Untitled

a guest
May 21st, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. class Recipe < ActiveRecord::Base
  2. has_friendly_id :title, :use_slug => true
  3.  
  4. belongs_to :origin
  5. has_many :recipe_ingredients
  6. has_many :ingredients, :through => :recipe_ingredients
  7.  
  8. end
  9.  
  10.  
  11.  
  12. class Ingredient < ActiveRecord::Base
  13. has_friendly_id :name, :use_slug => true
  14.  
  15. has_many :recipe_ingredients
  16. has_many :recipes, :through => :recipe_ingredients
  17. end
  18.  
  19.  
  20. class RecipeIngredient < ActiveRecord::Base
  21. belongs_to :recipe
  22. belongs_to :ingredient
  23. end
Add Comment
Please, Sign In to add comment