mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
Safe navigation for serializer value of RepositoryListItem
This commit is contained in:
parent
83f4344bb7
commit
13c9dd8cf6
2 changed files with 3 additions and 3 deletions
|
@ -11,5 +11,5 @@ class RepositoryChecklistItem < ApplicationRecord
|
|||
belongs_to :last_modified_by, foreign_key: 'last_modified_by_id', class_name: 'User',
|
||||
inverse_of: :modified_repository_checklist_types
|
||||
has_many :repository_checklist_items_values, dependent: :destroy
|
||||
has_many :repository_checklist_values, through: :repository_checklist_items_values
|
||||
has_many :repository_checklist_values, through: :repository_checklist_items_values, dependent: :destroy
|
||||
end
|
||||
|
|
|
@ -4,8 +4,8 @@ module RepositoryDatatable
|
|||
class RepositoryListValueSerializer < RepositoryBaseValueSerializer
|
||||
def value
|
||||
{
|
||||
id: object.repository_list_item.id,
|
||||
text: object.data
|
||||
id: (object.repository_list_item&.id || ''),
|
||||
text: (object.data || '')
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue