Sha256: a349f26e75d140d5008ff86a9cc0b934a9231e29c25d97f31fcd1f3480503ef0
Contents?: true
Size: 861 Bytes
Versions: 69
Compression:
Stored size: 861 Bytes
Contents
module Ecom module Core class TaskTemplate < ApplicationRecord has_ancestry belongs_to :task_template_type has_one :work_product_template 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
69 entries across 69 versions & 1 rubygems