aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models/developer.rb
diff options
context:
space:
mode:
authorAgis- <corestudiosinc@gmail.com>2014-07-15 03:25:18 +0300
committerAgis- <corestudiosinc@gmail.com>2014-08-20 08:25:58 +0300
commit431f8e01196044877c2acea4271410b1033ec915 (patch)
tree82a5a15529f75967a30d601eaa2099b6e1f4c8cf /activerecord/test/models/developer.rb
parent7422d2175d72f3e32f48f52ae4101cf4b6297c39 (diff)
downloadrails-431f8e01196044877c2acea4271410b1033ec915.tar.gz
rails-431f8e01196044877c2acea4271410b1033ec915.tar.bz2
rails-431f8e01196044877c2acea4271410b1033ec915.zip
Only merge scopes with zero arity in has_many through
with dynamic conditions. Fixes #16128 This bug was introduced in https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d so it's present from 4.1.2-rc1 and after. https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d merges any relation scopes passed as proc objects to the relation, but does *not* take into account the arity of the lambda. To reproduce: https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
Diffstat (limited to 'activerecord/test/models/developer.rb')
-rw-r--r--activerecord/test/models/developer.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index 5bd2f00129..3627cfdd09 100644
--- a/activerecord/test/models/developer.rb
+++ b/activerecord/test/models/developer.rb
@@ -46,6 +46,8 @@ class Developer < ActiveRecord::Base
has_many :audit_logs
has_many :contracts
has_many :firms, :through => :contracts, :source => :firm
+ has_many :comments, ->(developer) { where(body: "I'm #{developer.name}") }
+ has_many :ratings, through: :comments
scope :jamises, -> { where(:name => 'Jamis') }