Skip to content

don't stomp bodies in halt unless a body arg is given #235

@nweathersbee

Description

@nweathersbee

See

self.body(args.shift)

It is always overwriting body, even if there was already a body specified. It needs to only call the body method if the last optional arg (which would be the body) is given (ie not nil).

This is preventing code like this from working:

    rescue ActiveRecord::RecordNotFound
      body "Unknown company #{company_slug.inspect}."
      halt 422

The workaround you have to do for now is:

    rescue ActiveRecord::RecordNotFound
      halt 422, {}, "Unknown company #{company_slug.inspect}."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions