Method: CustomTable::ApplicationHelper#custom_table_user_customized_fields_for

Defined in:
app/helpers/custom_table/application_helper.rb

#custom_table_user_customized_fields_for(model, variant = nil) ⇒ Object

Prepares object of user fields customization



299
300
301
302
303
304
305
# File 'app/helpers/custom_table/application_helper.rb', line 299

def custom_table_user_customized_fields_for(model, variant = nil)
  fields_key = custom_table_fields_key(model, variant)
  defs = custom_table_fields_definition_for(model, variant)
  return nil if current_user.nil? || current_user.custom_table.nil? || current_user.custom_table.dig(fields_key, :fields).nil?
  return current_user.custom_table.dig(fields_key, :fields).symbolize_keys.reject{|k,v| defs[k.to_sym].nil?}
  
end