123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::ModelSchema::SchemaContext::DatabaseDefaultKeys

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: activerecord/lib/active_record/model_schema/schema_context.rb

Overview

The attributes that records loaded from the database fall back to defaults for when the row doesn't have them: the primary key, and attributes that aren't database columns. Other missing columns stay uninitialized.

Class Method Summary

Instance Method Summary

Constructor Details

.new(primary_key, columns_hash) ⇒ DatabaseDefaultKeys

[ GitHub ]

  
# File 'activerecord/lib/active_record/model_schema/schema_context.rb', line 15

def initialize(primary_key, columns_hash)
  @primary_key = primary_key
  @columns_hash = columns_hash
end

Instance Method Details

#include?(name) ⇒ Boolean

[ GitHub ]

  
# File 'activerecord/lib/active_record/model_schema/schema_context.rb', line 20

def include?(name)
  @primary_key.include?(name) || !@columns_hash.key?(name)
end