How to set response status to :created?

I want my response to include either the json or xml text, but I also
want it to include the http status 201. How can I do this?
if @manufacturer.save
format.xml { render :xml => @manufacturer.to_xml }
format.json { render :json => @manufacturer.to_json }
end

On 8/27/07, eggie5 [email protected] wrote:

I want my response to include either the json or xml text, but I also
want it to include the http status 201. How can I do this?
if @manufacturer.save
format.xml { render :xml => @manufacturer.to_xml }
format.json { render :json => @manufacturer.to_json }
end

add :status => :created after your render lineā€¦?

thanks

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs