Is it possible to configure the ClassTableInheritance plugin for Sequel to store anything other than the model name as a key?

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 set the column "account_type" in my account, which is an enumeration with the possible values ​​of "Twitter", "Facebook" and "Google" to determine which type of account.

I don't like the idea of ​​a column in my table bound to the name of my model classes. It directly connects me to the ORM that I use, and prevents me from changing model names.

Is there a way to provide the class_table_inheritance plugin with a key character map for class name characters in the same way that it is possible to provide a class name character tabular map for table name characters?

+4
source share
1 answer

Currently, the plugin class_table_inheritancedoes not support such a function (unlike the plugin single_table_inheritance). There is no need to add support for such a function, I will see if I can work on this in the near future.

+1
source

Source: https://habr.com/ru/post/1542049/


All Articles