Rails: has_many with extra details?
问题 While I'm not a complete Ruby/Rails newb, I'm still pretty green and I'm trying to figure out how to structure some model relationships. The simplest example I can think of is the idea of "recipes" for cooking. A recipe consists of one or more ingredients and the associated quantity of each ingredient. Assume we have a master list in the database of all ingredients. That suggests two simple models: class Ingredient < ActiveRecord::Base # ingredient name, end class Recipe < ActiveRecord::Base