aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-26 06:33:18 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-26 06:33:18 -0300
commit781370998d59bd45b951e0724ccf98871ecb68d2 (patch)
tree1d9588718dbc6ed491caac254b123aeba450ff45 /activerecord/lib/active_record/associations
parente1ad3ed7736d5e01455f881dff42d6bef54d8978 (diff)
parentc083ce6dd283303aaf0224943dcc759e52536adc (diff)
downloadrails-781370998d59bd45b951e0724ccf98871ecb68d2.tar.gz
rails-781370998d59bd45b951e0724ccf98871ecb68d2.tar.bz2
rails-781370998d59bd45b951e0724ccf98871ecb68d2.zip
Merge pull request #15847 from sgrif/sg-encapsulate-result-types
Encapsulate knowledge of type objects on `ActiveRecord::Result`
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/join_dependency.rb4
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb
index fbb4551b22..ec5c189cd3 100644
--- a/activerecord/lib/active_record/associations/join_dependency.rb
+++ b/activerecord/lib/active_record/associations/join_dependency.rb
@@ -131,7 +131,6 @@ module ActiveRecord
def instantiate(result_set, aliases)
primary_key = aliases.column_alias(join_root, join_root.primary_key)
- type_caster = result_set.column_type primary_key
seen = Hash.new { |h,parent_klass|
h[parent_klass] = Hash.new { |i,parent_id|
@@ -144,8 +143,7 @@ module ActiveRecord
column_aliases = aliases.column_aliases join_root
result_set.each { |row_hash|
- primary_id = type_caster.type_cast_from_database row_hash[primary_key]
- parent = parents[primary_id] ||= join_root.instantiate(row_hash, column_aliases)
+ parent = parents[row_hash[primary_key]] ||= join_root.instantiate(row_hash, column_aliases)
construct(parent, join_root, row_hash, result_set, seen, model_cache, aliases)
}