Create error_blueprint.rb
This commit is contained in:
parent
31e62e073c
commit
a1ff18092d
1 changed files with 15 additions and 0 deletions
15
app/blueprints/api/v1/error_blueprint.rb
Normal file
15
app/blueprints/api/v1/error_blueprint.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Api
|
||||
module V1
|
||||
class ErrorBlueprint < Blueprinter::Base
|
||||
field :error, if: ->(_field_name, _error, options) { options.key?(:error) } do |_, options|
|
||||
options[:error]
|
||||
end
|
||||
|
||||
field :errors, if: ->(_field_name, _error, options) { options.key?(:errors) } do |_, options|
|
||||
options[:errors]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue