ruby-grape / ruby-grape/grape

Rabl not running for DELETE

Open
#1,894 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

I am in the process of upgrading an old Rails app. Just tried increasing Grape from version 0.17.0 to 0.19.2. I hit on issue with the rabl no longer being processed for DELETE.

My API looks like:

desc 'Disable to send push notification'
delete '/push_notifiable', rabl: 'rooms/push_notifiable' do
  @room = Room.find(params[:room_id])
  @push_notifiable = false
end

And the test that now fails looks a bit like:

describe 'DELETE /rooms/:room_id/push_notifiable' do
  subject { delete url, params: params }
  it 'returns 200 status, and correct json' do
    subject
    expect(response.status).to eq 200
    expect(json['room']['room_type']).to eq 'XXXX'
  end
end

The status test passes, but the response body is no longer the JSON generated by my rabl, just simply the string false.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the shown DELETE route with the rabl option and the failing DELETE /rooms/:room_id/push_notifiable test as the reproduction. Trace why the response body becomes the string false after the Grape upgrade; done means the request still returns status 200 and the JSON generated by the rooms/push_notifiable Rabl template.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.