Module: GroupedScope::Arish::PredicateBuilder::ClassMethods

Defined in:
lib/grouped_scope/arish/relation/predicate_builer.rb

Instance Method Summary collapse

Instance Method Details

#build_from_hash_with_grouped_scope(engine, attributes, default_table, allow_table_name = true) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/grouped_scope/arish/relation/predicate_builer.rb', line 12

def build_from_hash_with_grouped_scope(engine, attributes, default_table, allow_table_name = true)
  attributes.select{ |column, value| GroupedScope::SelfGroupping === value }.each do |column_value|
    column, value = column_value
    attributes[column] = value.arel_table[column.to_s].in(value.ids_sql)
  end
  build_from_hash_without_grouped_scope(engine, attributes, default_table, allow_table_name)
end