diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-14 11:20:28 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-14 14:30:40 -0700 |
commit | 0f29c216074c5da6644feddb5184c4881c078b0d (patch) | |
tree | 5ace61c20fc1f4b54c9187567ffccc8c695c3c7e /activerecord/lib/active_record/model_schema.rb | |
parent | 70d1b5a7f8e25b077168deaf592e0e58c3f2bdd1 (diff) | |
download | rails-0f29c216074c5da6644feddb5184c4881c078b0d.tar.gz rails-0f29c216074c5da6644feddb5184c4881c078b0d.tar.bz2 rails-0f29c216074c5da6644feddb5184c4881c078b0d.zip |
Reduce the amount of work performed when instantiating AR models
We don't know which attributes will or won't be used, and we don't want
to create massive bottlenecks at instantiation. Rather than doing *any*
iteration over types and values, we can lazily instantiate the object.
The lazy attribute hash should not fully implement hash, or subclass
hash at any point in the future. It is not meant to be a replacement,
but instead implement its own interface which happens to overlap.
Diffstat (limited to 'activerecord/lib/active_record/model_schema.rb')
-rw-r--r-- | activerecord/lib/active_record/model_schema.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/model_schema.rb b/activerecord/lib/active_record/model_schema.rb index a444aac23c..adad7774b9 100644 --- a/activerecord/lib/active_record/model_schema.rb +++ b/activerecord/lib/active_record/model_schema.rb @@ -231,7 +231,7 @@ module ActiveRecord end def attributes_builder # :nodoc: - @attributes_builder ||= AttributeSet::Builder.new(column_types) + @attributes_builder ||= AttributeSet::Builder.new(column_types, primary_key) end def column_types # :nodoc: |