Method: StandardModel::ClassMethods#field_names

Defined in:
lib/app/models/concerns/standard_model.rb

#field_names(filter_names) ⇒ Object

allow the model to filter out a name if they want to, meaning the model can return a subset of attribute names



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/app/models/concerns/standard_model.rb', line 72

def field_names(filter_names)
  fields.collect do |field|
    next if filter_names.include?(field[0])

    case field[1].options[:type].to_s
    when 'Hash'
      { field[0] => {} }
    when 'Array'
      { field[0] => [] }
    else
      field[0]
    end
  end.compact
end