Permalink
Browse files

Simplify the code in target_scope

  • Loading branch information...
1 parent a3d41cb commit 384984d7ca188d1dae59b204650b8319de9f9f05 Jan Habermann committed Apr 3, 2014
Showing with 2 additions and 5 deletions.
  1. +2 −5 activerecord/lib/active_record/associations/through_association.rb
@@ -14,11 +14,8 @@ module ThroughAssociation #:nodoc:
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)

0 comments on commit 384984d

Please sign in to comment.