Sha256: ca85388ec20bf7e3da5159c32273f5c4526f2a7efc44be3276244286b7cde459

Contents?: true

Size: 867 Bytes

Versions: 1

Compression:

Stored size: 867 Bytes

Contents

module EducodeSales
  class Common < ApplicationRecord
    acts_as_list scope: [:clazz]


    validates :name, uniqueness: {scope: :clazz, message: '已存在'}
    
    enum clazz: {
      '商机类型': 'business_type',
      '商机阶段': 'business_step',
      '关键人态度': 'key_attitude',
      '教师来源': 'teacher_source' ,
      '教师态度': 'teacher_attitude',
      '课堂建设': 'course_build',
      '跟进手段': 'contact',
      '人员类型': 'staff_type',
      '区域': 'area'
    }

    def self.job_type_name
      self.where(clazz: 'staff_type', name: ['销售', '运营']).pluck(:id, :name).to_h
    end

    def self.teacher_source_name
      self.where(clazz: 'teacher_source').pluck(:id, :name).to_h
    end

    def self.key_attitude_name
      self.where(clazz: 'key_attitude').pluck(:id, :name).to_h
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
educode_sales-0.1.0 app/models/educode_sales/common.rb