STI helper/model mapper

I am currently using STI to manage three different types of Users on a site. I find this to be a great solution when it comes to DRYing authentication and basic fields for each type of user. My only caveat with this method is adding type specific fields to the three classes of users. Currently each type has it's own ____Profile model (AdminProfile, CatProfile, DogProfile, etc.). To avoid always having to do things like cat.cat_profile.fur_color, I've been manually mapping attributes of the ____Profile classes to their respective user class so I can just do cat.fur_color. This makes my code a lot cleaner on the controller and view side, but is huge mess on the model side. I am wondering if there is a plugin/gem to do these kinds of mappings automatically.

Thanks for your help, Brendan

You're probably looking for the 'delegate' method that ActiveSupport defines. Here's an example:

class Foo < ActiveRecord::Base   belongs_to :bar end

class Bar < ActiveRecord::Base   has_one :foo

  delegate :method_one, :method_two, :method_three, :to => :foo end

If maintaining that list becomes burdensome, you could probably metaprogram something by grabbing Foo.attributes or the like.

--Matt Jones