pretty_print removed
This commit is contained in:
parent
db5bbcb93a
commit
93fd3eeda4
|
@ -250,7 +250,6 @@ class SmqlToAR
|
||||||
def build builder, table
|
def build builder, table
|
||||||
@cols.each do |col, sub|
|
@cols.each do |col, sub|
|
||||||
t = table+col.to_a
|
t = table+col.to_a
|
||||||
p t: t, sub: sub
|
|
||||||
builder.sub_join t, col, *sub[0..1]
|
builder.sub_join t, col, *sub[0..1]
|
||||||
sub[2..-1].each &it.build( builder, t)
|
sub[2..-1].each &it.build( builder, t)
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,24 +79,20 @@ class SmqlToAR
|
||||||
end
|
end
|
||||||
|
|
||||||
def sub_join table, col, model, query
|
def sub_join table, col, model, query
|
||||||
pp [:sub_join, table, col. model, query]
|
|
||||||
prefix, base_table = "#{@prefix}_sub", col.col
|
prefix, base_table = "#{@prefix}_sub", col.col
|
||||||
join_ table, model, "(#{query.build( prefix, base_table).tap{|q| p :sub_join => q }.ar.to_sql})"
|
join_ table, model, "(#{query.build( prefix, base_table).ar.to_sql})"
|
||||||
end
|
end
|
||||||
|
|
||||||
def join_ table, model, query, pretable = nil
|
def join_ table, model, query, pretable = nil
|
||||||
pp [:join_, table, model, query]
|
|
||||||
pretable ||= table[0...-1]
|
pretable ||= table[0...-1]
|
||||||
@table_model[ table] = model
|
@table_model[ table] = model
|
||||||
premodel = @table_model[ pretable]
|
premodel = @table_model[ pretable]
|
||||||
t = @table_alias[ table]
|
t = @table_alias[ table]
|
||||||
pt = quote_table_name @table_alias[ table[ 0...-1]]
|
pt = quote_table_name @table_alias[ table[ 0...-1]]
|
||||||
pp premodel: premodel, table: table
|
|
||||||
refl = premodel.reflections[table.last]
|
refl = premodel.reflections[table.last]
|
||||||
case refl
|
case refl
|
||||||
when ActiveRecord::Reflection::ThroughReflection
|
when ActiveRecord::Reflection::ThroughReflection
|
||||||
through = refl.through_reflection
|
through = refl.through_reflection
|
||||||
pp refl: refl
|
|
||||||
throughtable = table[0...-1]+[through.name.to_sym]
|
throughtable = table[0...-1]+[through.name.to_sym]
|
||||||
srctable = throughtable+[refl.source_reflection.name]
|
srctable = throughtable+[refl.source_reflection.name]
|
||||||
@table_model[ srctable] = model
|
@table_model[ srctable] = model
|
||||||
|
|
Loading…
Reference in a new issue