As far as setting up the many-to-many relationship using has_and_belongs_to_many, this is pretty well covered in the Rails guide on Active Record associations ( http://guides.rubyonrails.org/association_basics.html#the-has_and_belongs_to_many-association) and the API documentation ( http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#method-i-has_and_belongs_to_many). I think this answers your question, but repost if not.
On Sun, Feb 13, 2011 at 9:22 AM, rogi <[email protected]> wrote: > Hi folks > > I need to create a "training database". The idea is to track all the > trainings a workers has participated. > So I created a table for the workers (basically with field id and > name) and one for the trainings (id, title decription). > > Now the question: How shall I assign the workers to the trainings? For > each training there will be multiple workers that participated. Can I > add them to a field of the corresponding trainingstable entry or do I > need to dynamically create participants tables with one participants > field? > > BR > rogi > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

