aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorTyler Distad <tyler.distad@gmail.com>2016-05-16 19:24:55 -0400
committerTyler Distad <tyler.distad@gmail.com>2016-05-16 19:31:58 -0400
commit82bb0084b4c0de231a374ce9ca7c70391e9aa6e6 (patch)
treece561b849c2237f7cfadf5f343cd7978c5c4acff /activerecord
parentf85bbed4cdc1bdfd1e0dbd97bce9db81e44cbd11 (diff)
downloadrails-82bb0084b4c0de231a374ce9ca7c70391e9aa6e6.tar.gz
rails-82bb0084b4c0de231a374ce9ca7c70391e9aa6e6.tar.bz2
rails-82bb0084b4c0de231a374ce9ca7c70391e9aa6e6.zip
Associations do not call `.to_proc` on Hash
Fixes #25010
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG.md6
-rw-r--r--activerecord/lib/active_record/associations/association.rb2
-rw-r--r--activerecord/lib/active_record/associations/join_dependency/join_association.rb2
-rw-r--r--activerecord/lib/active_record/associations/preloader/association.rb2
4 files changed, 9 insertions, 3 deletions
diff --git a/activerecord/CHANGELOG.md b/activerecord/CHANGELOG.md
index 34d14f1a80..28fc8959c1 100644
--- a/activerecord/CHANGELOG.md
+++ b/activerecord/CHANGELOG.md
@@ -1,3 +1,9 @@
+* Support Ruby 2.3 by not unexpectedly calling `.to_proc` on Hash objects
+
+ Fixes #25010
+
+ *tlrdstd*
+
## Rails 3.2.22 (Jun 16, 2015) ##
* No changes.
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb
index 99f307922e..abee941c07 100644
--- a/activerecord/lib/active_record/associations/association.rb
+++ b/activerecord/lib/active_record/associations/association.rb
@@ -158,7 +158,7 @@ module ActiveRecord
end
def interpolate(sql, record = nil)
- if sql.respond_to?(:to_proc)
+ if sql.respond_to?(:to_proc) && !sql.is_a?(Hash)
owner.send(:instance_exec, record, &sql)
else
sql
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
index becf1a3f62..7aaa24d767 100644
--- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb
+++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb
@@ -146,7 +146,7 @@ module ActiveRecord
private
def interpolate(conditions)
- if conditions.respond_to?(:to_proc)
+ if conditions.respond_to?(:to_proc) && !conditions.is_a?(Hash)
instance_eval(&conditions)
else
conditions
diff --git a/activerecord/lib/active_record/associations/preloader/association.rb b/activerecord/lib/active_record/associations/preloader/association.rb
index 85b1040049..44b4164e9b 100644
--- a/activerecord/lib/active_record/associations/preloader/association.rb
+++ b/activerecord/lib/active_record/associations/preloader/association.rb
@@ -113,7 +113,7 @@ module ActiveRecord
end
def process_conditions(conditions)
- if conditions.respond_to?(:to_proc)
+ if conditions.respond_to?(:to_proc) && !conditions.is_a?(Hash)
conditions = klass.send(:instance_eval, &conditions)
end