1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Allow select statement node's initializer takes a table

Like other statement nodes does, related to 333f9b32.
This commit is contained in:
Ryuta Kamizono 2021-03-08 02:49:33 +09:00
parent 1c97c5b2c2
commit c48539ff94
3 changed files with 5 additions and 6 deletions

View file

@ -6,9 +6,9 @@ module Arel # :nodoc: all
attr_accessor :projections, :wheres, :groups, :windows, :comment
attr_accessor :havings, :source, :set_quantifier, :optimizer_hints
def initialize
def initialize(relation = nil)
super()
@source = JoinSource.new nil
@source = JoinSource.new(relation)
# https://ronsavage.github.io/SQL/sql-92.bnf.html#set%20quantifier
@set_quantifier = nil

View file

@ -6,9 +6,9 @@ module Arel # :nodoc: all
attr_reader :cores
attr_accessor :limit, :orders, :lock, :offset, :with
def initialize(cores = [SelectCore.new])
def initialize(relation = nil)
super()
@cores = cores
@cores = [SelectCore.new(relation)]
@orders = []
@limit = nil
@lock = nil

View file

@ -8,9 +8,8 @@ module Arel # :nodoc: all
def initialize(table = nil)
super()
@ast = Nodes::SelectStatement.new
@ast = Nodes::SelectStatement.new(table)
@ctx = @ast.cores.last
from table
end
def initialize_copy(other)