views:

11

answers:

0

I'm thinking about creating a Rails 3 app that will integrate with an existing PHP app, using the same database.

The trouble is that the PHP app uses polymorphic associations of sorts, placing references to the PHP class names like MyPHPAppPrefix_User in the owner_type column. (Odd prefix stuff, yes, but what's done is done.) To reproduce that relationship in Rails using the standard polymorphism mechanism doesn't seem like it will work, since Rails would look for a MyPHPAppPrefix_User class instead of a User class.

How can I go about implementing this polymorphic relationship in Rails, given the difference in class names? Can I use built-in relationship methods at all, or will I have to define my own methods that act like the standard relationship API?

(Not certain that I chose the best tags; StackOverflow's Javascript doesn't seem to be loading on this particular computer.)