diff options
author | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-11 13:48:18 -0700 |
---|---|---|
committer | Nick Kallen <nkallen@nick-kallens-computer-2.local> | 2008-04-11 13:48:18 -0700 |
commit | e6f6fbc5c7bd12ac0c122cdfdfc448329919e603 (patch) | |
tree | c31078f921b918b5bfa35cd63ecf944b15301614 /lib | |
parent | 42c42bfa50876b4221c024cebc47fc34fc6530a9 (diff) | |
download | rails-e6f6fbc5c7bd12ac0c122cdfdfc448329919e603.tar.gz rails-e6f6fbc5c7bd12ac0c122cdfdfc448329919e603.tar.bz2 rails-e6f6fbc5c7bd12ac0c122cdfdfc448329919e603.zip |
refactored bind for order
Diffstat (limited to 'lib')
-rw-r--r-- | lib/active_relation/relations/order.rb | 3 | ||||
-rw-r--r-- | lib/active_relation/relations/relation.rb | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/active_relation/relations/order.rb b/lib/active_relation/relations/order.rb index bfd05f48b3..95b73c5e90 100644 --- a/lib/active_relation/relations/order.rb +++ b/lib/active_relation/relations/order.rb @@ -3,8 +3,9 @@ module ActiveRelation attr_reader :order def initialize(relation, *orders) - @order = orders.pop + order = orders.pop @relation = orders.empty?? relation : Order.new(relation, *orders) + @order = order.bind(@relation) end def ==(other) diff --git a/lib/active_relation/relations/relation.rb b/lib/active_relation/relations/relation.rb index f7e47c2e50..36c13bec51 100644 --- a/lib/active_relation/relations/relation.rb +++ b/lib/active_relation/relations/relation.rb @@ -50,7 +50,7 @@ module ActiveRelation end def order(*attributes) - Order.new(self, *attributes.collect {|a| a.bind(self)}) + Order.new(self, *attributes) end def rename(attribute, aliaz) |