you need has_and_belongs_to_many
http://railsbrain.com/api/rails-2.3.2/doc/index.html?a=M001888&name=has_and_belongs_to_many



On Tue, Feb 23, 2010 at 11:32 AM, pepe <[email protected]> wrote:

> Hi,
>
> Working with legacy DB here...
>
> 2 tables:
>  Projects
>  Workers
>
> A worker record has many fields in it to hold project codes as in:
> project1, project2, project3, ... project30 (great, isn't it?...)
>
> Normalizing the DB is out of the question.
>
> I've been thinking about this for a while and I can't find a way to
> associate both tables as in:
>
> "Project has_many :workers"
> "Worker.project1 belongs_to :project"
> "Worker.project2 belongs_to :project"
> etc.
>
> Any ideas?
>
> Pepe
>
> --
> 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]<rubyonrails-talk%[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.

Reply via email to