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_currency ⇒ Object
Returns the value of attribute current_currency.
-
#current_user ⇒ Object
Returns the value of attribute current_user.
-
#properties ⇒ Object
Returns the value of attribute properties.
Instance Method Summary collapse
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
- #method_missing(name) ⇒ Object
- #retrieve_products ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/spree/core/search/base.rb', line 26 def method_missing(name) if @properties.key? name @properties[name] else super end end |
Instance Attribute Details
#current_currency ⇒ Object
Returns the value of attribute current_currency.
7 8 9 |
# File 'lib/spree/core/search/base.rb', line 7 def current_currency @current_currency end |
#current_user ⇒ Object
Returns the value of attribute current_user.
6 7 8 |
# File 'lib/spree/core/search/base.rb', line 6 def current_user @current_user end |
#properties ⇒ Object
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_products ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/spree/core/search/base.rb', line 15 def retrieve_products @products = get_base_scope curr_page = page || 1 unless Spree::Config.show_products_without_price @products = @products.where('spree_prices.amount IS NOT NULL'). where('spree_prices.currency' => current_currency) end @products = @products.page(curr_page).per(per_page) end |