Colin Law wrote in post #989292: > On 25 March 2011 20:24, R. K. <li...@ruby-forum.com> wrote: >> belongs_to :ingredient >> t.datetime "created_at" >> t.string "equivalent" >> t.datetime "created_at" >> t.datetime "updated_at" >> end > > It is the belongs_to object that should have the foreign key, so > measurement should have an ingredient_id, not vice versa. Or the > relationship should be the other way round. > > Colin
I agree which is what is happening in the recipe object I set up. Should I be using has_and_belongs_to_many instead since since one measurement could belong to many different ingredients i.e. a cup of flour will be used in more than one recipe so that ingredient will be listed more than once? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.