Skip to content

Commit f60b1d5

Browse files
committed
Move id_value definition to the primary_key concern
1 parent b0af8c9 commit f60b1d5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

activerecord/lib/active_record/attribute_methods/primary_key.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ def inherited(base)
152152
@attributes_builder = nil
153153
end
154154
end
155+
156+
def load_schema! # :nodoc:
157+
super
158+
alias_attribute :id_value, :id if @columns_hash.key?("id")
159+
end
155160
end
156161
end
157162
end

activerecord/lib/active_record/model_schema.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@ def load_schema!
583583
columns_hash = connection.schema_cache.columns_hash(table_name)
584584
columns_hash = columns_hash.except(*ignored_columns) unless ignored_columns.empty?
585585
@columns_hash = columns_hash.freeze
586-
alias_attribute :id_value, :id if @columns_hash.key?("id")
587586
end
588587

589588
# Guesses the table name, but does not decorate it with prefix and suffix information.

0 commit comments

Comments
 (0)