Class: Spree::Zoned::Search::Base

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



13
14
15
16
# File 'lib/spree/zoned/search/base.rb', line 13

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/spree/zoned/search/base.rb', line 25

def method_missing(name)
  if @properties.has_key? name
    @properties[name]
  else
    super
  end
end

Instance Attribute Details

#propertiesObject

Returns the value of attribute properties.



11
12
13
# File 'lib/spree/zoned/search/base.rb', line 11

def properties
  @properties
end

Instance Method Details

#retrieve_productsObject



18
19
20
21
22
23
# File 'lib/spree/zoned/search/base.rb', line 18

def retrieve_products
  @products_scope = get_base_scope
  curr_page = page || 1

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