Class: SmqlToAR::ConditionTypes::Select

Inherits:
Condition
  • Object
show all
Defined in:
lib/smql_to_ar/condition_types.rb

Constant Summary collapse

Operator =
''
Expected =
[nil]

Constants inherited from Condition

Condition::Where

Instance Attribute Summary

Attributes inherited from Condition

#cols, #value

Instance Method Summary collapse

Methods inherited from Condition

#condition_build, #initialize, inspect, #inspect, try_parse, #verify, #verify_allowed

Methods included from Assertion

#raise_if, #raise_unless

Constructor Details

This class inherits a constructor from SmqlToAR::ConditionTypes::Condition

Instance Method Details

#select_build(builder, table) ⇒ Object Also known as: build



383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/smql_to_ar/condition_types.rb', line 383

def select_build builder, table
	@cols.each do |col|
		if col.exist_in?
			col.joins builder, table
			builder.select table+col.to_a
		else
			col.joins {|j, m| builder.includes table+j }
			builder.includes table+col.to_a
		end
	end
	self
end

#verify_column(col) ⇒ Object



379
380
381
# File 'lib/smql_to_ar/condition_types.rb', line 379

def verify_column col
	raise_unless col.exist_in? || SmqlToAR.model_of( col.last_model, col.col), NonExistingSelectableError.new( col)
end