diff options
-rw-r--r-- | lib/arel/nodes/select_core.rb | 9 | ||||
-rw-r--r-- | lib/arel/visitors/to_sql.rb | 2 |
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), |