中的連接表的額外屬性我有一個Recipe
,Ingredient
和RecipeIngredient
。從has_many到
class Recipe
has_many :recipe_ingredients
has_many :ingredients, through: :recipe_ingredients
end
我RecipeIngredient
有一個像amount
,unit
,type
等
如果我從recipe.ingredients
想找回這些額外的屬性附加屬性,我將如何去在那個非常不的方式引入N + 1查詢或其他任何會降低性能的問題?