Class: Spree::Core::Search::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/search/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



7
8
9
10
# File 'lib/spree/core/search/base.rb', line 7

def initialize(params)
  @properties = {}
  prepare(params)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



20
21
22
# File 'lib/spree/core/search/base.rb', line 20

def method_missing(name)
  @properties[name]
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



5
6
7
# File 'lib/spree/core/search/base.rb', line 5

def properties
  @properties
end

Instance Method Details

#retrieve_productsObject



12
13
14
15
16
17
18
# File 'lib/spree/core/search/base.rb', line 12

def retrieve_products
  base_scope = get_base_scope
  @products_scope = @product_group.apply_on(base_scope)
  curr_page = manage_pagination && keywords ? 1 : page

  @products = @products_scope.includes([:images, :master]).page(curr_page).per(per_page)
end