Class: SpreeCmCommissioner::TicketsSearcherQuery
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::TicketsSearcherQuery
- Defined in:
- app/queries/spree_cm_commissioner/tickets_searcher_query.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#tenant_id ⇒ Object
readonly
Returns the value of attribute tenant_id.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(params, tenant_id) ⇒ TicketsSearcherQuery
constructor
A new instance of TicketsSearcherQuery.
Constructor Details
#initialize(params, tenant_id) ⇒ TicketsSearcherQuery
Returns a new instance of TicketsSearcherQuery.
5 6 7 8 |
# File 'app/queries/spree_cm_commissioner/tickets_searcher_query.rb', line 5 def initialize(params, tenant_id) @params = params @tenant_id = tenant_id end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/tickets_searcher_query.rb', line 3 def params @params end |
#tenant_id ⇒ Object (readonly)
Returns the value of attribute tenant_id.
3 4 5 |
# File 'app/queries/spree_cm_commissioner/tickets_searcher_query.rb', line 3 def tenant_id @tenant_id end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'app/queries/spree_cm_commissioner/tickets_searcher_query.rb', line 10 def call return Spree::Product.none if tenant_id.blank? search = Spree::Product.ransack( tenant_id_eq: tenant_id, name_i_cont_all: params[:term]&.split ) search.result.distinct end |