aboutsummaryrefslogtreecommitdiffstats
path: root/lib/arel/select_manager.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-09-20 14:27:34 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-09-20 14:27:34 -0700
commitb95deec5c77f92083b456469d22ca7a4b6880827 (patch)
tree6b7132195afbf3bf82451ff005f3e46d9ec802b0 /lib/arel/select_manager.rb
parentd8de55cee197d887b478b134ec692776613bf998 (diff)
downloadrails-b95deec5c77f92083b456469d22ca7a4b6880827.tar.gz
rails-b95deec5c77f92083b456469d22ca7a4b6880827.tar.bz2
rails-b95deec5c77f92083b456469d22ca7a4b6880827.zip
from does not need to be a list
Diffstat (limited to 'lib/arel/select_manager.rb')
-rw-r--r--lib/arel/select_manager.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/arel/select_manager.rb b/lib/arel/select_manager.rb
index 98d9385b0a..4866ea66c9 100644
--- a/lib/arel/select_manager.rb
+++ b/lib/arel/select_manager.rb
@@ -39,7 +39,7 @@ module Arel
end
def on *exprs
- @ctx.froms.last.constraint = Nodes::On.new(collapse(exprs))
+ @ctx.froms.constraint = Nodes::On.new(collapse(exprs))
self
end
@@ -59,8 +59,8 @@ module Arel
# FIXME: this is a hack to support
# test_with_two_tables_in_from_without_getting_double_quoted
# from the AR tests.
- unless @ctx.froms.empty?
- source = @ctx.froms.first
+ if @ctx.froms
+ source = @ctx.froms
if Nodes::SqlLiteral === table && Nodes::Join === source
source.left = table
@@ -68,7 +68,7 @@ module Arel
end
end
- @ctx.froms = [table]
+ @ctx.froms = table
self
end
@@ -78,9 +78,9 @@ module Arel
case relation
when String, Nodes::SqlLiteral
raise if relation.blank?
- from Nodes::StringJoin.new(@ctx.froms.pop, relation)
+ from Nodes::StringJoin.new(@ctx.froms, relation)
else
- from klass.new(@ctx.froms.pop, relation, nil)
+ from klass.new(@ctx.froms, relation, nil)
end
end
@@ -162,7 +162,7 @@ module Arel
# FIXME: this method should go away
def insert values
im = InsertManager.new @engine
- im.into @ctx.froms.last
+ im.into @ctx.froms
im.insert values
@engine.connection.insert im.to_sql
end