Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Should allow server side 201 with one cute line of code

#6

In order to support 201 on resource creation, Restfulie currently requires you to:

1) respond_with @order, :status => 201, :location => order_url(@order)
and create a create.tokamak file

2) render :text => "" , :status => 201, :location => order_url(@order)

(head 201, :location ...) is not an option because Rails seems to wrongly send a one whitespace string as a result.

Both should be easier implemented as something like the following, automatically noticing its a 201 and requires the Resource location, while rendering it with the resource itself (show.tokamak).

respond_with @order, :status => 201

Reported by Guilherme Silveira · April 3rd, 2010 @ 08:41 PM

State: resolved
Milestone: v0.9
Assigned to: Guilherme Silveira Guilherme Silveira

Activity

  1. Guilherme Silveira
    Guilherme Silveira
    • Milestone set to v0.9
    • Assigned user set to Guilherme Silveira

    June 3rd, 2010 @ 11:52 AM

  2. Guilherme Silveira
    Guilherme Silveira
    • Assigned user cleared.

    responder should check if resource.created? then return a 201!

    June 10th, 2010 @ 04:13 PM

  3. Guilherme Silveira
    Guilherme Silveira

    it should be possible to override this and say, i want to go to to the rendering process (i.e. the html)

    June 10th, 2010 @ 04:14 PM

  4. Guilherme Silveira
    Guilherme Silveira
    • Tag changed from server to feature, server
    • State changed from new to resolved
    • Assigned user set to Guilherme Silveira

    respond_with @resource, :status => 201

    June 11th, 2010 @ 09:17 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.