Module: InheritableSchema

Defined in:
app/models/base_new.rb

Overview

Sequel::Model plugin extends :schema plugin to merge the column definitions in its parent class.

class Model1 < Sequel::Model

plugin InheritableSchema

inheritable_schema do
  String :col1
end

end

class Model2 < Model1

inheritable_schema do
  String :col2
end

end

Model2.create_table!

Then the schema for Model2 becomes as follows:

primary_key :id, :type=>Integer, :unsigned=>true
String :col1
String :col2

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.apply(model) ⇒ Object



192
193
194
# File 'app/models/base_new.rb', line 192

def self.apply(model)
  model.plugin :schema
end