aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-19 16:55:42 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-06-19 16:55:42 -0300
commit197364f8fd34373bb032220f39a98f7c63a67ee3 (patch)
treee09ae94247a5fc57cb25a5b43becf9b6708cc65d /activerecord/lib/active_record/associations
parent8f42372ef1d102bc1b7fe067e181d9ff4dca70b1 (diff)
parentab6bea72db1712568a47ec0a43e55b7facd82bba (diff)
downloadrails-197364f8fd34373bb032220f39a98f7c63a67ee3.tar.gz
rails-197364f8fd34373bb032220f39a98f7c63a67ee3.tar.bz2
rails-197364f8fd34373bb032220f39a98f7c63a67ee3.zip
Merge pull request #15803 from sgrif/sg-column-in-associations
Don't rely on the column for type casting reflections
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb
index 306588ac66..065a2cff01 100644
--- a/activerecord/lib/active_record/associations/collection_association.rb
+++ b/activerecord/lib/active_record/associations/collection_association.rb
@@ -55,9 +55,9 @@ module ActiveRecord
# Implements the ids writer method, e.g. foo.item_ids= for Foo.has_many :items
def ids_writer(ids)
- pk_column = reflection.primary_key_column
+ pk_type = reflection.primary_key_type
ids = Array(ids).reject { |id| id.blank? }
- ids.map! { |i| pk_column.type_cast_from_user(i) }
+ ids.map! { |i| pk_type.type_cast_from_user(i) }
replace(klass.find(ids).index_by { |r| r.id }.values_at(*ids))
end