Class: WorkItems::Type
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- WorkItems::Type
- Includes:
- CacheMarkdownField
- Defined in:
- app/models/work_items/type.rb
Constant Summary collapse
- BASE_TYPES =
Base types need to exist on the DB on app startup This constant is used by the DB seeder
{ issue: { name: 'Issue', icon_name: 'issue-type-issue', enum_value: 0 }, incident: { name: 'Incident', icon_name: 'issue-type-incident', enum_value: 1 }, test_case: { name: 'Test Case', icon_name: 'issue-type-test-case', enum_value: 2 }, ## EE-only requirement: { name: 'Requirement', icon_name: 'issue-type-requirements', enum_value: 3 }, ## EE-only task: { name: 'Task', icon_name: 'issue-type-task', enum_value: 4 } }.freeze
Constants included from CacheMarkdownField
CacheMarkdownField::INVALIDATED_BY
Constants inherited from ApplicationRecord
Class Method Summary collapse
Instance Method Summary collapse
Methods included from CacheMarkdownField
#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #local_version, #mentionable_attributes_changed?, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #updated_cached_html_for
Methods inherited from ApplicationRecord
cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from SensitiveSerializableHash
Class Method Details
.allowed_types_for_issues ⇒ Object
51 52 53 |
# File 'app/models/work_items/type.rb', line 51 def self.allowed_types_for_issues base_types.keys.excluding('task') end |
.default_by_type(type) ⇒ Object
43 44 45 |
# File 'app/models/work_items/type.rb', line 43 def self.default_by_type(type) find_by(namespace_id: nil, base_type: type) end |
.default_issue_type ⇒ Object
47 48 49 |
# File 'app/models/work_items/type.rb', line 47 def self.default_issue_type default_by_type(:issue) end |
Instance Method Details
#default? ⇒ Boolean
55 56 57 |
# File 'app/models/work_items/type.rb', line 55 def default? namespace.blank? end |