Class: Avo::Filters::MultipleSelectFilter

Inherits:
BaseFilter
  • Object
show all
Defined in:
lib/avo/filters/multiple_select_filter.rb

Constant Summary

Constants inherited from BaseFilter

BaseFilter::PARAM_KEY

Instance Attribute Summary

Attributes inherited from BaseFilter

#arguments

Instance Method Summary collapse

Methods inherited from BaseFilter

#applied_filters, #applied_or_default_value, #apply_query, #current_user, decode_filters, encode_filters, get_empty_message, #id, #initialize, #visible_in_view

Constructor Details

This class inherits a constructor from Avo::Filters::BaseFilter

Instance Method Details

#selected_value(applied_filters) ⇒ Object

The input expects an array of strings for the value Ex: [‘admins’, ‘non_admins’]



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/avo/filters/multiple_select_filter.rb', line 8

def selected_value(applied_filters)
  # Get the values for this particular filter
  applied_value = applied_filters[self.class.to_s]

  # Return that value if present
  return applied_value unless applied_value.nil?

  # Return that default
  return default unless default.nil?

  []
end