Class: ServiceType
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ServiceType
- Defined in:
- app/models/service_type.rb
Overview
Schema Information
Table name: service_types
id :bigint not null, primary key
logo :string(191)
name :string(191)
type_code :string(191)
created_at :datetime not null
updated_at :datetime not null
service_type_id :bigint not null
Constant Summary collapse
- PACKAGE_TYPES =
{ dine_in: %i[ayce pp diy], delivery: [:hah], experience: [:xp], }.freeze
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from ApplicationRecord
Class Method Details
.short_code_to_service_type ⇒ Object
38 39 40 41 42 |
# File 'app/models/service_type.rb', line 38 def self.short_code_to_service_type ServiceType::PACKAGE_TYPES.each_with_object({}) do |(key, values), h| values.each { |value| h[value] = key } end end |
Instance Method Details
#packages ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/models/service_type.rb', line 28 def packages codes = ServiceType::PACKAGE_TYPES[type_code.to_sym] codes.map do |code| { name: HhPackage::PACKAGE_SHORT_LIST_AND_LONG_NAME[code], type_code: code, } end end |