Module: Superstore::ModelSchema::ClassMethods
- Defined in:
- lib/superstore/model_schema.rb
Instance Method Summary collapse
- #attribute_names ⇒ Object
-
#attributes_builder ⇒ Object
:nodoc:.
- #column_names ⇒ Object
-
#load_schema! ⇒ Object
:nodoc:.
Instance Method Details
#attribute_names ⇒ Object
26 27 28 |
# File 'lib/superstore/model_schema.rb', line 26 def attribute_names attribute_types.keys end |
#attributes_builder ⇒ Object
:nodoc:
10 11 12 |
# File 'lib/superstore/model_schema.rb', line 10 def attributes_builder # :nodoc: @attributes_builder ||= ActiveModel::AttributeSet::Builder.new(attribute_types, _default_attributes) end |
#column_names ⇒ Object
30 31 32 |
# File 'lib/superstore/model_schema.rb', line 30 def column_names attribute_names end |
#load_schema! ⇒ Object
:nodoc:
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/superstore/model_schema.rb', line 14 def load_schema! # :nodoc: @columns_hash = {} attributes_to_define_after_schema_loads.each do |name, (type, )| if type.is_a?(Symbol) type = ActiveRecord::Type.lookup(type, **.except(:default)) end define_attribute(name, type, **.slice(:default)) end end |