Method: Marty::DataGrid#build_index

Defined in:
app/models/marty/data_grid.rb

#build_indexObject

FIXME: should be private



865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
# File 'app/models/marty/data_grid.rb', line 865

def build_index
  # create indices for the metadata
  .each do |inf|
    attr = inf['attr']
    type = inf['type']
    keys = inf['keys']
    nots = inf.fetch('nots', [])

    # find index class
    idx_class = Marty::DataGrid.type_to_index(type)

    keys.each_with_index do |k, index|
      gi              = idx_class.new
      gi.attr         = attr
      gi.key          = k
      gi.created_dt   = created_dt
      gi.data_grid_id = group_id
      gi.index        = index
      gi.not          = nots[index] || false
      gi.save!
    end
  end
end