4

I am using the class_table_inheritance Sequel plugin for my project and I have the following models:

class Account < Sequel::Model
  plugin :class_table_inheritance
end

class TwitterAccount < Account; end
class FacebookAccount < Account; end
class GoogleAccount < Account; end

I would prefer to setup a column called 'account_type' in my Account table that is an enum with the possible values 'Twitter', 'Facebook' and 'Google' to identify what type an account is.

I don't like the idea of a column in my table that is tied to the name of my model classes. It directly ties me to the ORM I am using and prevents changing the model names.

Is there any way to provide to the class_table_inheritance plugin a key map of symbols to class name symbols just like there is the ability to provide a table map of class name symbols to table name symbols?

Reid Main
  • 3,394
  • 3
  • 25
  • 42

1 Answers1

1

Currently, the class_table_inheritance plugin doesn't support such a feature (unlike the single_table_inheritance plugin). It shouldn't be difficult to add support for such a feature, I'll see if I can work on that soon.

Jeremy Evans
  • 11,959
  • 27
  • 26
  • I see you already implemented this feature in a commit https://github.com/jeremyevans/sequel/commit/7eb78fe6a6b4a6974040e47f659bef3b13bf485c many thanks! – Reid Main May 30 '14 at 13:33