Module: Torque::PostgreSQL::Relation::AuxiliaryStatement

Included in:
Torque::PostgreSQL::Relation
Defined in:
lib/torque/postgresql/relation/auxiliary_statement.rb

Instance Method Summary collapse

Instance Method Details

#auxiliary_statements_valuesObject

:nodoc:



9
# File 'lib/torque/postgresql/relation/auxiliary_statement.rb', line 9

def auxiliary_statements_values; get_value(:auxiliary_statements); end

#auxiliary_statements_values=(value) ⇒ Object

:nodoc:



11
# File 'lib/torque/postgresql/relation/auxiliary_statement.rb', line 11

def auxiliary_statements_values=(value); set_value(:auxiliary_statements, value); end

#bound_attributesObject

Get all auxiliary statements bound attributes and the base bound attributes as well



29
30
31
32
33
34
35
# File 'lib/torque/postgresql/relation/auxiliary_statement.rb', line 29

def bound_attributes
  visitor = ::Arel::Visitors::PostgreSQL.new(ActiveRecord::Base.connection)
  visitor.accept(self.arel.ast, ::Arel::Collectors::Composite.new(
    ::Arel::Collectors::SQLString.new,
    ::Arel::Collectors::Bind.new,
  )).value.last
end

#with(*args, **settings) ⇒ Object Also known as: auxiliary_statements

Set use of an auxiliary statement



14
15
16
# File 'lib/torque/postgresql/relation/auxiliary_statement.rb', line 14

def with(*args, **settings)
  spawn.with!(*args, **settings)
end

#with!(*args, **settings) ⇒ Object Also known as: auxiliary_statements!

Like #with, but modifies relation in place.



19
20
21
22
# File 'lib/torque/postgresql/relation/auxiliary_statement.rb', line 19

def with!(*args, **settings)
  instantiate_auxiliary_statements(*args, **settings)
  self
end