Class: Avo::Filters::BooleanFilter

Inherits:
BaseFilter show all
Defined in:
lib/avo/filters/boolean_filter.rb

Constant Summary

Constants inherited from BaseFilter

Avo::Filters::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(item, applied_filters) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/avo/filters/boolean_filter.rb', line 6

def selected_value(item, applied_filters)
  # See if there are any applied rules for this particular filter
  if applied_filters[self.class.to_s].present?
    # Symbolize the keys because they are returned from de-serialization (JSON and Base64)
    applied_filters[self.class.to_s].stringify_keys.dig(item.to_s)
  else
    applied_or_default_value(applied_filters).stringify_keys.dig(item.to_s)
  end
rescue
  false
end