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
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/app/models/concerns/standard_model.rb', line 99 def field_names(filter_names) fields.collect do |field| next if filter_names.include?(field[0]) case field[1].[:type].to_s when 'Hash' { field[0] => {} } when 'Array' { field[0] => [] } else field[0] end end.compact end |