Using fetch instead of direct refference for hash

This commit is contained in:
Shinya Maeda 2017-03-17 17:05:27 +09:00
parent 361f85122b
commit 9d56cb6a0d
2 changed files with 2 additions and 2 deletions

View File

@ -7,6 +7,6 @@ class BuildSerializer < BaseSerializer
def represent_status(resource)
data = represent(resource, { only: [:status] })
data[:status]
data.fetch(:status, {})
end
end

View File

@ -25,6 +25,6 @@ class PipelineSerializer < BaseSerializer
def represent_status(resource)
data = represent(resource, { only: [{ details: [:status] }] })
data[:details][:status]
data.fetch(:details, {}).fetch(:status, {})
end
end