Class: FortyFacets::SqlFacetFilterDefinition

Inherits:
FilterDefinition show all
Defined in:
lib/forty_facets/filter/sql_facet_filter_definition.rb

Defined Under Namespace

Classes: ScopeFacetFilter

Instance Attribute Summary collapse

Attributes inherited from FilterDefinition

#association, #attribute, #column_name, #joins, #options, #origin_class, #path, #search, #table_name

Instance Method Summary collapse

Methods inherited from FilterDefinition

#qualified_column_name

Constructor Details

#initialize(search, queries, opts) ⇒ SqlFacetFilterDefinition

Returns a new instance of SqlFacetFilterDefinition.



5
6
7
8
9
10
11
12
# File 'lib/forty_facets/filter/sql_facet_filter_definition.rb', line 5

def initialize(search, queries, opts)
  @search = search
  @queries = queries
  @path = Array(opts[:path]) if opts[:path].present?
  @joins = Array(opts[:joins]) if opts[:joins].present?
  @path ||= @queries.keys
  @options = opts
end

Instance Attribute Details

#queriesObject (readonly)

Returns the value of attribute queries.



3
4
5
# File 'lib/forty_facets/filter/sql_facet_filter_definition.rb', line 3

def queries
  @queries
end

Instance Method Details

#build_filter(search_instance, param_value) ⇒ Object



18
19
20
# File 'lib/forty_facets/filter/sql_facet_filter_definition.rb', line 18

def build_filter(search_instance, param_value)
  ScopeFacetFilter.new(self, search_instance, param_value)
end

#request_paramObject



14
15
16
# File 'lib/forty_facets/filter/sql_facet_filter_definition.rb', line 14

def request_param
  path.join("-")
end