Method: ActiveModel::AttributeFilters#attributes_to_filter
- Defined in:
- lib/attribute-filters/dsl_filters.rb
#attributes_to_filter(set_name, process_all, no_presence_check) ⇒ AttributeSet #attributes_to_filter(attribute_set, process_all, no_presence_check) ⇒ AttributeSet
Gets names of attributes for which filters should be applied by selecting attributes that are meeting certain criteria and belong to the given attribute set.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/attribute-filters/dsl_filters.rb', line 42 def attributes_to_filter(set_name, process_all = false, no_presence_check = false) set_name.blank? and return ::ActiveModel::AttributeSet.new atf = set_name.is_a?(::ActiveModel::AttributeSet) ? set_name : self.class.send(:__attribute_sets)[set_name.to_sym] if process_all no_presence_check ? atf.deep_dup : atf & __all_attributes(false) else sr = self.class.send(:__attribute_filters_semi_real) atf & ((no_presence_check ? sr : sr.select_accessible(self)) + changes.keys) end end |