aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorJan Habermann <jan@habermann24.com>2014-04-03 12:40:38 +0200
committerJan Habermann <jan@habermann24.com>2014-04-03 12:40:38 +0200
commit384984d7ca188d1dae59b204650b8319de9f9f05 (patch)
tree07c38acceba940c59e748325d82704845b47d975 /activerecord/lib/active_record/associations
parenta3d41cb071ae0fc567c3e3ab7afea9356789cbcf (diff)
downloadrails-384984d7ca188d1dae59b204650b8319de9f9f05.tar.gz
rails-384984d7ca188d1dae59b204650b8319de9f9f05.tar.bz2
rails-384984d7ca188d1dae59b204650b8319de9f9f05.zip
Simplify the code in target_scope
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/through_association.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/through_association.rb b/activerecord/lib/active_record/associations/through_association.rb
index 66b1616949..942abf7df1 100644
--- a/activerecord/lib/active_record/associations/through_association.rb
+++ b/activerecord/lib/active_record/associations/through_association.rb
@@ -14,11 +14,8 @@ module ActiveRecord
def target_scope
scope = super
chain.drop(1).each do |reflection|
- relation = if reflection.scope
- reflection.klass.all.instance_eval(&reflection.scope)
- else
- reflection.klass.all
- end
+ relation = reflection.klass.all
+ relation.instance_eval(&reflection.scope) if reflection.scope
scope.merge!(
relation.except(:select, :create_with, :includes, :preload, :joins, :eager_load)