Class: Workarea::Admin::SearchCustomizationProductRulesViewModel
- Inherits:
-
ProductRulesPreviewViewModel
- Object
- ApplicationViewModel
- ProductRulesPreviewViewModel
- Workarea::Admin::SearchCustomizationProductRulesViewModel
- Defined in:
- app/view_models/workarea/admin/search_customization_product_rules_view_model.rb
Instance Method Summary collapse
- #display_results? ⇒ Boolean
-
#search ⇒ Workarea::Search::ProductSearch
Fetches search results of products for product search.
Methods inherited from ProductRulesPreviewViewModel
#base_query, #results, #show_all?, wrap
Instance Method Details
#display_results? ⇒ Boolean
20 21 22 |
# File 'app/view_models/workarea/admin/search_customization_product_rules_view_model.rb', line 20 def display_results? true # With query we can always show preview even without rules end |
#search ⇒ Workarea::Search::ProductSearch
Fetches search results of products for product search. Extends search class with Search::AdminProductRulesPreview to allow overriding display rules.
11 12 13 14 15 16 17 18 |
# File 'app/view_models/workarea/admin/search_customization_product_rules_view_model.rb', line 11 def search @search ||= Search::ProductSearch.new( q: model.query, rules: model.product_rules.usable, page: [:page] || 1, show_all: show_all? ).tap { |s| s.extend(Search::AdminProductRulesPreview) } end |