Closed alimi closed 3 years ago
Also, if there's a bunch of records that need to be updated in prod you can run something like the following on the console.
Magma::Attribute.each do |attribute|
attribute.update(type: attribute.type.match("Magma::(.*)Attribute")[1].underscore)
end
You'll have to restart the server though so the cached attributes in memory get reloaded.
Without a
key_map
, the Sequel single table inheritance plugin will use themodel_map
to insert values into the database. ForMagma::Attribute
, this resulted in types being inserted as Ruby classes (i.e.,Magma::IntegerAttribute
) instead of strings (i.e.,integer
). By configuringkey_map
, we can make sureMagma::Attribute
types are inserted as strings.Info on the plugin can be found here: http://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Plugins/SingleTableInheritance.html.