Sha256: d211e5e5183c2216f7a907c50ec2dfee5cc5fe40b3e98ea38dfb3cb0c2230fe3

Contents?: true

Size: 715 Bytes

Versions: 3

Compression:

Stored size: 715 Bytes

Contents

class RESTFramework::Errors::NilPassedToRenderAPIError < RESTFramework::Errors::BaseError
  def message
    return <<~MSG.split("\n").join(" ")
      Payload of `nil` was passed to `render_api`; this is unsupported. If you want a blank
      response, pass `''` (an empty string) as the payload. If this was the result of a `find_by`
      (or similar Active Record method) not finding a record, you should use the bang version (e.g.,
      `find_by!`) to raise `ActiveRecord::RecordNotFound`, which the REST controller will catch and
      return an appropriate error response.
    MSG
  end
end

# Alias for convenience.
RESTFramework::NilPassedToRenderAPIError = RESTFramework::Errors::NilPassedToRenderAPIError

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rest_framework-1.0.0.beta2 lib/rest_framework/errors/nil_passed_to_render_api_error.rb
rest_framework-1.0.0.beta1 lib/rest_framework/errors/nil_passed_to_render_api_error.rb
rest_framework-0.11.0 lib/rest_framework/errors/nil_passed_to_render_api_error.rb