Please excuse me if I am asking too many questions. I''ve been appreciating the help (and I have been learning from reading other peoples questions and answers too) Here is a cooked up example of a basic idea I am trying to accomplish Say that I have a Pupil model . Perhaps also a Teacher, Course models. Teachers will have things called Course_Offerings. To keep track of a pupils performance in a course there will be a separate model called Course_performances. These course_performances will belong to both Pupils and to Course_offerings. In addition to foreign keys, Id like the course_performance records to have their own copy of the Pupils "full_name" for easy access in views. Given a list of Pupils, is the code below an efficient way of creating a course_performance instance and associating it with (and assuring that it gets foreign keys from) two separate models it belongs to? Do I need to save the new course_performances at all or will they get saved as I associate them to parent classes? Will the "transaction" work the way I have it or should I chose the name of the whole database to apply the transaction to? (I wasn''t clear on what the book meant me to use) def create_course_performances @pupils_to_add = Pupil.find(:all, :conditions => [some_condition "something" ] ) @course_offering Course_offering.find_by_id(params[:course_offering_id] @pupils_to_add.each do |current_pupil| holder = Course_performance.new(:name => current_pupil.full_name ) Pupil.transaction do current_pupil.course_performances << holder @course_offering.course_performances << holder end end end Thanks in advance for any tips. -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---