> class CommentsController < ApplicationController
>  respond_to :html, :xml
>  def new
>    @comment = Comment.new
>    respond_with(@comment, :status => :created)
>  end
> end

It's off topic, but this is a curious response code to send for new.
You haven't created anything at all ;)

> For html requests, the response code will be the standard :ok 200
> code. But for xml request, or json, or any other acceptable request
> mime type, the :created status will be returned.

This kind of thing is to be expected because sending the 'right'
response code to a browser doesn't lead to the correct behaviour from
a user's perspective.  For example an API's create action sends a 201
response, however browsers want a 302 redirect.  You can see this kind
of thing here:

https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/metal/responder.rb#L142-167

> So, should I add the test case and submit the patch, or should I
> update the documentation to be clear that it doesn't work for html
> requests? Oh also, it's not specific to just :status, it also doesn't
> work for several other options.

I believe it's deliberate here, but if you can track down some errant
looking code, do raise a ticket with a patch.


> On a related note, I tried using the #display method like in the
> excerpted comments, but I get a wrong number of arguments error (2 for
> 0..1).
>
> Thanks everyone!
>
> -Steve Schwartz
> @jangosteve
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>



-- 
Cheers

Koz

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to