Class: Workarea::Search::Admin::PricingDiscount

Inherits:
Workarea::Search::Admin show all
Includes:
Releasable
Defined in:
app/models/workarea/search/admin/pricing_discount.rb

Instance Method Summary collapse

Methods included from Releasable

#status

Methods inherited from Workarea::Search::Admin

#created_at, for, #id, jump_to, #jump_to_param, #jump_to_route_helper, #jump_to_search_text, #name, #releasable?, #sanitized_keywords, #should_be_indexed?, #status, #updated_at

Methods included from Elasticsearch::Document

all, #as_bulk_document, current_index_prefix, #destroy, #initialize, #save

Instance Method Details

#as_documentObject



31
32
33
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 31

def as_document
  super.merge(total_redemptions: model.redemptions.count)
end

#facetsObject



27
28
29
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 27

def facets
  super.merge(discount_type: model.class.name.demodulize.titleize)
end

#jump_to_positionObject



19
20
21
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 19

def jump_to_position
  9
end

#jump_to_textObject



15
16
17
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 15

def jump_to_text
  model.name
end

#keywordsObject



23
24
25
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 23

def keywords
  super + model.promo_codes
end

#search_textObject



11
12
13
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 11

def search_text
  "discount #{model.name}"
end

#typeObject



7
8
9
# File 'app/models/workarea/search/admin/pricing_discount.rb', line 7

def type
  'discount'
end