I have single table inheritance working just fine for my app. I have two user subtypes (Athlete and Company) that inherit the super-type User.
Let's say I am listing all users, and want a link to each user's profile from this list. I want to link to the athletes controller if the type is athlete and the companies controller if the type is company. Is there a standard Rails way to this? Maybe some routing tricks?
you can even do that much simpler, Rails recognizes which type of user it has to deal with, so let's say you have the instance variable @user wich can either be an Athlete or a Company, you can just do that
= link_to "Profile", @user
BAM! Rails magic!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With