Table structure needed

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

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.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs