aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-12-07 14:20:30 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-07 14:20:30 -0800
commit9a5b5e533600de7421700fd8f1498bfa0ce42a9c (patch)
treee630c4f53775849898a7b145d0fb0d5e1216cc48
parent89194f5976d09a62f967e550daeda41ac0b9de48 (diff)
downloadrails-9a5b5e533600de7421700fd8f1498bfa0ce42a9c.tar.gz
rails-9a5b5e533600de7421700fd8f1498bfa0ce42a9c.tar.bz2
rails-9a5b5e533600de7421700fd8f1498bfa0ce42a9c.zip
converting froms to from
-rw-r--r--lib/arel/nodes/select_core.rb9
-rw-r--r--lib/arel/visitors/to_sql.rb2
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/arel/nodes/select_core.rb b/lib/arel/nodes/select_core.rb
index acc6bb9815..e2293f68a2 100644
--- a/lib/arel/nodes/select_core.rb
+++ b/lib/arel/nodes/select_core.rb
@@ -1,11 +1,14 @@
module Arel
module Nodes
class SelectCore < Arel::Nodes::Node
- attr_accessor :froms, :projections, :wheres, :groups
+ attr_accessor :from, :projections, :wheres, :groups
attr_accessor :having
+ alias :froms= :from=
+ alias :froms :from
+
def initialize
- @froms = nil
+ @from = nil
@projections = []
@wheres = []
@groups = []
@@ -14,7 +17,7 @@ module Arel
def initialize_copy other
super
- @froms = @froms.clone if @froms
+ @from = @from.clone if @from
@projections = @projections.clone
@wheres = @wheres.clone
@group = @groups.clone
diff --git a/lib/arel/visitors/to_sql.rb b/lib/arel/visitors/to_sql.rb
index b71f8219bf..9f581ee470 100644
--- a/lib/arel/visitors/to_sql.rb
+++ b/lib/arel/visitors/to_sql.rb
@@ -114,7 +114,7 @@ module Arel
def visit_Arel_Nodes_SelectCore o
[
"SELECT #{o.projections.map { |x| visit x }.join ', '}",
- ("FROM #{visit o.froms}" if o.froms),
+ ("FROM #{visit o.from}" if o.from),
("WHERE #{o.wheres.map { |x| visit x }.join ' AND ' }" unless o.wheres.empty?),
("GROUP BY #{o.groups.map { |x| visit x }.join ', ' }" unless o.groups.empty?),
(visit(o.having) if o.having),