Method: StandardModel::ClassMethods#allowed_param_names
- Defined in:
- lib/app/models/concerns/standard_model.rb
#allowed_param_names(filter_names = [], include_relationships = true) ⇒ Object
Return the complete list of key names that would appear in the form.
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/app/models/concerns/standard_model.rb', line 63 def allowed_param_names(filter_names = [], include_relationships = true) # Always filter out the mongoid reserved items filter_names += %w[created_at updated_at _type _id search_text sort_text] associations = many_to_many_associations # filter out the relationship names so we don't have dups associations.each { |association| filter_names << association.keys.first } names = field_names(filter_names) names += associations if include_relationships names.delete_if { |name| filter_names.include?(name) } rescue StandardError attribute_names.delete_if { |name| filter_names.include?(name) } end |