I''ve got an application that tracks different types of Tasks and the differing tasks have subclasses like PersonalTask and WorkTask. These are stored in the database along with their "type" (type is a column in the database). This allows things like: p = new PersonalTask("Go shopping") p.save w = new WorkTask("File Reports") w.save all = Task.find(:all) print "First task is of type ", all[0].type.to_s # Prints #<PersonalTask:0x70000000 @attributes{"name"=>"Go shopping", "type"=>"PersonalTask", ...} print "Second task of type ", all[1].type.to_s # Prints #<WorkTask:0x70000000 @attributes{"name"=>"File Reports", "type"=>"WorkTask", ...} Notice how the type of the object is preserved. Nifty, except use of "type" is deprecated and it should now be "class". Unfortunately this trick doesn''t work when you change "type" to "class" as a column in the DB. Since this will completely break when "type" really goes away I was wondering what people suggest as a replacement given there are ~8 types. I''d hate to have to create a factory method the knows about all the types since that seems a little inelegant compared to the auto- subclassing I have now. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---