Sha256: b73e84e8747e135641a51fa69da93a2be4d7b9b2018aa545449ef1f5392b03e1
Contents?: true
Size: 1.27 KB
Versions: 23
Compression:
Stored size: 1.27 KB
Contents
module EducodeSales class Common < ApplicationRecord acts_as_list scope: [:clazz] has_many :market_areas, class_name: 'MarketArea', foreign_key: 'area_id' has_many :sale_plans, dependent: :nullify XTYPE = "x_class" OTYPE = 'o_class' ATYPE = 'a_class' BTYPE = 'b_class' CTYPE = 'c_class' DTYPE = 'd_class' ETYPE = 'e_class' validates :name, uniqueness: {scope: :clazz, message: '已存在'} enum clazz: { '商机类型': 'business_type', '商机阶段': 'business_step', '关键人态度': 'key_attitude', '教师来源': 'teacher_source' , '教师态度': 'teacher_attitude', '课堂建设': 'course_build', '跟进手段': 'contact', '人员类型': 'staff_type', '开课计划': 'course_plan', '区域': 'area', '计划类型': 'plan_type' } def self.job_type_name self.where(clazz: 'staff_type').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 def self.teacher_attitude_name self.where(clazz: 'teacher_attitude').pluck(:id, :name).to_h end end end
Version data entries
23 entries across 23 versions & 1 rubygems