2009/10/2 Andreas <[email protected]>:
>
> Hi
>
> I've just started looking into building a rails frontend to a database
> project I've been working on but I need some help with how to convert
> some parts of the database.
>
> The database got a bunch of tables each describing a different type of
> entity and each of these entities can have several comments. I've
> solved this by giving all entities an identifier through a master
> identifier table (entityId1 --> masterId, entityId2 --> masterId) but
> I can't think of any way to get this working in rails and also it's
> kinda an ugly hack in my opinion.
>
> Any thoughts on this? Thought of using some sort of guid but most
> people seem to think it's not worth it?

_If_ I understand I think you might want to look at polymorphic
relationships.
http://wiki.rubyonrails.org/howtos/db-relationships/polymorphic might
be a good start.  This would allow your different model types all to
have comments without repeating the code everywhere.

Colin

--~--~---------~--~----~------------~-------~--~----~
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