Method: ActionBlocks::FilterAdapter#get_arel_attributes

Defined in:
lib/action_blocks/data_engine/filter_adapter.rb

#get_arel_attributesObject

Convert all fields to arel nodes while building up needed @engine.joins



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/action_blocks/data_engine/filter_adapter.rb', line 25

def get_arel_attributes()
  @fields = get_fields(@rls_scheme)
  @arel_attributes = {}
  [@fields].flatten.each do |f|
    f = ActionBlocks.find("field-#{@model_id}-#{f}")
    select_req = f.select_requirements
    if select_req[:type] == :summary
      raise "Summary fields not supported in authorizations"
    end
    field_name = select_req[:field_name]
    node, *rest = select_req[:path]
    @arel_attributes[field_name] = walk_path(@engine.root_klass, node, @engine.root_key, rest)
  end
  return @arel_attributes
end