Sha256: 89c9f41a721fc81a67e5e32bcb1c5cac7f7e18d7c803566c3ef57cdc04e22885

Contents?: true

Size: 723 Bytes

Versions: 9

Compression:

Stored size: 723 Bytes

Contents

class RESTFramework::Errors::NilPassedToAPIResponseError < RESTFramework::Errors::BaseError
  def message
    return <<~MSG.split("\n").join(" ")
      Payload of `nil` was passed to `api_response`; 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::NilPassedToAPIResponseError = RESTFramework::Errors::NilPassedToAPIResponseError

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rest_framework-0.10.0 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.16 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.15 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.14 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.12.pre.1.pre.g39306cb lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.11.pre.40.pre.g5dcad32 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.11 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.10 lib/rest_framework/errors/nil_passed_to_api_response_error.rb
rest_framework-0.9.9 lib/rest_framework/errors/nil_passed_to_api_response_error.rb