Class: ActiveModel::AttributeSet::Builder::FromDBContext
Do not use. This class is for internal use only.
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Context
|
|
|
Instance Chain:
self,
Context
|
|
| Inherits: |
ActiveModel::AttributeSet::Builder::Context
|
| Defined in: | activemodel/lib/active_model/attribute_set/builder.rb |
Overview
For records loaded from the database, which only fall back to the defaults in #default_keys. Other attributes the row doesn't have are missing.
Class Method Summary
Context - Inherited
Instance Attribute Summary
Context - Inherited
Instance Method Summary
Context - Inherited
| #default_at | The default attribute for the attribute at |
| #name_at | The name of the attribute at |
| #type_at | The type of the attribute at |
| #type_key_at? | : (Integer) -> bool? |
Constructor Details
.new(names, type_table, defaults, default_keys) ⇒ FromDBContext
[ GitHub ]
# File 'activemodel/lib/active_model/attribute_set/builder.rb', line 76
def initialize(names, type_table, defaults, default_keys) defaults = names.each_with_index.map do |name, index| defaults[index] if default_keys.include?(name) end super(names, type_table, defaults.freeze) end