You could just build your own associations solution instead of trying to patch the polymorphic associations.
Also, if you have indexes for the columns, the time "searching" for the row isn't really different than it would be for a number instead of a varchar. The database should hit the result row in the same time. On Tue, Oct 7, 2008 at 11:07 PM, Aryk Grosz < [EMAIL PROTECTED]> wrote: > > This has been bugging me for some time. > > The implementation for polymorphic associations in Rails is *still* > using the record_type, record_id model where record type has to be the > entire written out class name. > > All of this logic is hardcoded deep in ActiveRecord, making it very > difficult to deviate from this. > > For example, what if I wanted to have the "type" column be a tinyint > unsigned that mapped with the name of the class in some hash? Or what if > I wanted to infer the type from a different column all together? > > Repeating a long classname for every row in a database is repetitive and > can eat up database size. For example, "SomeLongModuleName::ModelName" > could be replaced with "1", which would then map to that name. That > would be 1 byte for the TinyInt(3) implementation vs N bytes for > actually spelling out the class name *every* time. > > Whats frustrating me is the inability to easily configure this, or even > to patch this to get it to work properly. Is anyone also having issues > with this or is there anything out there to give you more control over > polymorphic associations? > > Aryk Grosz > Mixbook.com > -- > Posted via http://www.ruby-forum.com/. > > -- Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) João Pessoa, PB, +55 83 8867-7208 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

