Class: FacetedSearch::Facets::Tree

Inherits:
DefaultList show all
Defined in:
app/models/faceted_search/facets/tree.rb

Instance Attribute Summary

Attributes inherited from Default

#facets, #name, #params

Instance Method Summary collapse

Methods inherited from DefaultList

#add_scope, #display_method, #find_by, #path_for, #source, #value_selected?

Methods inherited from Default

#add_scope, #initialize, #kind, #path, #path_for, #title, #to_s

Constructor Details

This class inherits a constructor from FacetedSearch::Facets::Default

Instance Method Details

#children_scopeObject



4
5
6
# File 'app/models/faceted_search/facets/tree.rb', line 4

def children_scope
  @options[:children_scope] ||= Proc.new { |children| children }
end

#selected_objectObject



12
13
14
# File 'app/models/faceted_search/facets/tree.rb', line 12

def selected_object
  source.find_by(find_by => params_array.last)
end

#selected_objectsObject



8
9
10
# File 'app/models/faceted_search/facets/tree.rb', line 8

def selected_objects
  source.where(find_by => params_array)
end

#valuesObject

All values, not filtered Otherwise, we would need to search all the children to do a good filtering



18
19
20
21
# File 'app/models/faceted_search/facets/tree.rb', line 18

def values
  root? ? values_root
        : values_children
end