scinote-web/app/serializers/step_table_serializer.rb

18 lines
317 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class StepTableSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :name, :urls
def urls
2022-05-04 16:25:53 +08:00
return if object.destroyed?
object.reload unless object.step
{
delete_url: step_table_path(object.step, object)
}
end
end