aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_scope.rb
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2014-09-02 14:13:32 -0400
committereileencodes <eileencodes@gmail.com>2014-09-04 08:16:13 -0400
commit0b6358beb417f69c47edd93d099906cc818855ee (patch)
tree994cb4b82fe64f2de02b6a17d0d15ca27ecf0712 /activerecord/lib/active_record/associations/association_scope.rb
parentb8fbcc0787dde662049794ea4555c8aa52847843 (diff)
downloadrails-0b6358beb417f69c47edd93d099906cc818855ee.tar.gz
rails-0b6358beb417f69c47edd93d099906cc818855ee.tar.bz2
rails-0b6358beb417f69c47edd93d099906cc818855ee.zip
Always add lambda to scope chain to eliminate branch in eval_scope
We convert all other scopes to lambda's so it makes sense that we should always returns a lambda on a ThroughReflection as well. This eliminates the need to check if the scope is a Relation.
Diffstat (limited to 'activerecord/lib/active_record/associations/association_scope.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_scope.rb6
1 files changed, 1 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/association_scope.rb b/activerecord/lib/active_record/associations/association_scope.rb
index b58c902bfc..43e1e79fcf 100644
--- a/activerecord/lib/active_record/associations/association_scope.rb
+++ b/activerecord/lib/active_record/associations/association_scope.rb
@@ -188,11 +188,7 @@ module ActiveRecord
end
def eval_scope(klass, scope, owner)
- if scope.is_a?(Relation)
- scope
- else
- klass.unscoped.instance_exec(owner, &scope)
- end
+ klass.unscoped.instance_exec(owner, &scope)
end
end
end