diff options
Diffstat (limited to 'lib/active_relation/relations')
-rw-r--r-- | lib/active_relation/relations/relation.rb | 2 | ||||
-rw-r--r-- | lib/active_relation/relations/selection.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb index db61fce3de..f7e47c2e50 100644 --- a/lib/active_relation/relations/relation.rb +++ b/lib/active_relation/relations/relation.rb @@ -38,7 +38,7 @@ module ActiveRelation end def select(*predicates) - Selection.new(self, *predicates.collect {|p| p.bind(self)}) + Selection.new(self, *predicates) end def project(*attributes) diff --git a/lib/active_relation/relations/selection.rb b/lib/active_relation/relations/selection.rb index fe28908cc2..032de63d04 100644 --- a/lib/active_relation/relations/selection.rb +++ b/lib/active_relation/relations/selection.rb @@ -3,8 +3,9 @@ module ActiveRelation attr_reader :predicate def initialize(relation, *predicates) - @predicate = predicates.shift + predicate = predicates.shift @relation = predicates.empty?? relation : Selection.new(relation, *predicates) + @predicate = predicate.bind(@relation) end def ==(other) |