module ActiveHouse::Querying::ArrayJoin

Public Instance Methods

array_join(*fields) click to toggle source
# File lib/active_house/querying/array_join.rb, line 27
def array_join(*fields)
  dup.array_join!(*fields)
end
array_join!(*fields) click to toggle source
# File lib/active_house/querying/array_join.rb, line 21
def array_join!(*fields)
  formatted_fields = ActiveHouse::PreparedStatement.format_fields(model_class, fields)
  values[:array_join] = (values[:array_join] + formatted_fields).uniq
  self
end
build_array_join_query_part() click to toggle source
# File lib/active_house/querying/array_join.rb, line 10
def build_array_join_query_part
  parts = []
  parts << "ARRAY JOIN #{values[:array_join].join(', ')}" unless values[:array_join].empty?
  parts << "LEFT ARRAY JOIN #{values[:array_join].join(', ')}" unless values[:left_array_join].empty?
  parts.join("\n")
end
initial_values() click to toggle source
Calls superclass method
# File lib/active_house/querying/array_join.rb, line 17
def initial_values
  super.merge array_join: [], left_array_join: []
end
left_array_join(*fields) click to toggle source
# File lib/active_house/querying/array_join.rb, line 37
def left_array_join(*fields)
  dup.left_array_join!(*fields)
end
left_array_join!(*fields) click to toggle source
# File lib/active_house/querying/array_join.rb, line 31
def left_array_join!(*fields)
  formatted_fields = ActiveHouse::PreparedStatement.format_fields(model_class, fields)
  values[:left_array_join] = (values[:left_array_join] + formatted_fields).uniq
  self
end