Class: Stall::ProductsSearchService
- Inherits:
-
BaseService
- Object
- BaseService
- Stall::ProductsSearchService
- Defined in:
- app/services/stall/products_search_service.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#products ⇒ Object
readonly
Returns the value of attribute products.
-
#search ⇒ Object
readonly
Returns the value of attribute search.
Instance Method Summary collapse
- #call ⇒ Object
-
#form ⇒ Object
Returns the value of attribute search.
-
#initialize(products, params) ⇒ ProductsSearchService
constructor
A new instance of ProductsSearchService.
- #records ⇒ Object
Constructor Details
#initialize(products, params) ⇒ ProductsSearchService
6 7 8 9 |
# File 'app/services/stall/products_search_service.rb', line 6 def initialize(products, params) @products = products @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/services/stall/products_search_service.rb', line 3 def params @params end |
#products ⇒ Object (readonly)
Returns the value of attribute products.
3 4 5 |
# File 'app/services/stall/products_search_service.rb', line 3 def products @products end |
#search ⇒ Object (readonly)
Returns the value of attribute search.
3 4 5 |
# File 'app/services/stall/products_search_service.rb', line 3 def search @search end |
Instance Method Details
#call ⇒ Object
11 12 13 |
# File 'app/services/stall/products_search_service.rb', line 11 def call @search = products.ransack(params[:search]) end |
#form ⇒ Object
Returns the value of attribute search.
4 5 6 |
# File 'app/services/stall/products_search_service.rb', line 4 def search @search end |
#records ⇒ Object
19 20 21 |
# File 'app/services/stall/products_search_service.rb', line 19 def records search.result.distinct end |