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
<patrik.keller-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.