Sha256: 51fbaf0ca85650a41801dedb97ad889575b4f736c4a97f89ad055a14d22f6c57
Contents?: true
Size: 941 Bytes
Versions: 17
Compression:
Stored size: 941 Bytes
Contents
module Ecom module Core class TaskTemplate < ApplicationRecord has_ancestry belongs_to :task_template_type has_and_belongs_to_many :work_product_templates, join_table: 'ecom_core_task_templates_work_product_templates' has_and_belongs_to_many :resource_types, join_table: 'ecom_core_task_templates_resource_types' validates :name, :code, presence: true validates :code, uniqueness: true delegate(:name, to: :task_template_type, prefix: true) def full_name parent_name = parent&.name return name unless parent_name "#{name} - #{parent_name}" end def crew_types resource_types.where(type: 'Ecom::Core::CrewType') end def material_types resource_types.where(type: 'Ecom::Core::MaterialType') end def equipment_types resource_types.where(type: 'Ecom::Core::EquipmentType') end end end end
Version data entries
17 entries across 17 versions & 1 rubygems