mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-21 06:51:25 +08:00
18 lines
497 B
Ruby
18 lines
497 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ChecklistSerializer < ActiveModel::Serializer
|
|
include Rails.application.routes.url_helpers
|
|
|
|
attributes :id, :name, :urls
|
|
has_many :checklist_items, serializer: ChecklistItemSerializer
|
|
|
|
def urls
|
|
return {} if object.destroyed?
|
|
|
|
{
|
|
delete_url: step_checklist_path(object.step, object),
|
|
update_url: step_checklist_path(object.step, object),
|
|
create_item_url: step_checklist_checklist_items_path(object.step, object)
|
|
}
|
|
end
|
|
end
|