I am having these models in my application:
class Ingredient < ApplicationRecord
has_many :recipe_ingredients
has_many :recipes, through: :recipe_ingredients
end
class RecipeIngredient < ApplicationRecord
belongs_to :recipe
belongs_to :ingredient
end
class Recipe < ApplicationRecord
has_many :recipe_ingredients
has_many :ingredients, through: :recipe_ingredients
end
But Recipe model already has had a text field with same name ingredients
, so this setting has_many :ingredients, through: :recipe_ingredients
should be changed.
How can I change the name ingredients
to somethings(ingredient_items
) else by using source
or as
?