Class: Spree::Core::Search::Base
- Inherits:
-
Object
- Object
- Spree::Core::Search::Base
- Defined in:
- lib/spree/core/search/base.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#pricing_options ⇒ Object
Returns the value of attribute pricing_options.
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
- #current_currency ⇒ Object
- #current_currency=(currency) ⇒ Object
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
- #method_missing(name) ⇒ Object
- #respond_to_missing?(name) ⇒ Boolean
- #retrieve_products ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/spree/core/search/base.rb', line 40 def method_missing(name) if @properties.key?(name) Spree::Deprecation.warn "Accessing Searcher's #{name} property using #{self.class.name}##{name} is deprecated without replacement" @properties[name] else super end end |
Instance Attribute Details
#current_user ⇒ Object
Returns the value of attribute current_user.
10 11 12 |
# File 'lib/spree/core/search/base.rb', line 10 def current_user @current_user end |
#pricing_options ⇒ Object
Returns the value of attribute pricing_options.
11 12 13 |
# File 'lib/spree/core/search/base.rb', line 11 def @pricing_options end |
#properties ⇒ Object
Returns the value of attribute properties.
9 10 11 |
# File 'lib/spree/core/search/base.rb', line 9 def properties @properties end |
Instance Method Details
#current_currency ⇒ Object
25 26 27 |
# File 'lib/spree/core/search/base.rb', line 25 def current_currency .currency end |
#current_currency=(currency) ⇒ Object
19 20 21 22 23 |
# File 'lib/spree/core/search/base.rb', line 19 def current_currency=(currency) self. = Spree::Config..new( .desired_attributes.merge(currency: currency) ) end |
#respond_to_missing?(name) ⇒ Boolean
49 50 51 |
# File 'lib/spree/core/search/base.rb', line 49 def respond_to_missing?(name) @properties.key?(name) || super(name) end |
#retrieve_products ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/spree/core/search/base.rb', line 30 def retrieve_products @products = get_base_scope curr_page = @properties[:page] || 1 unless Spree::Config.show_products_without_price @products = @products.joins(:prices).merge(Spree::Price.where(.search_arguments)).distinct end @products = @products.page(curr_page).per(@properties[:per_page]) end |