REST standard actions: why does "new" action have a .xml flavor?

When I generate a REST controller scaffold I get an action that looks something like:

  # GET /users/new   # GET /users/new.xml   def new     @user = User.new

    respond_to do |format|       format.html # new.html.erb       format.xml { render :xml => @user }     end   end

model to kind of 'pre-populate' the form, but nothing is saved until the "update" action is called.

So what is a scenario where a REST web service call of "new" would make any useful sense, like: XXX Sex - Free Porn Videos at XXX.com

This is a nuance I am not following. Anyone?

Very good point! But like you said the new method might be used to pre- populate the object. If this is the case an XML would be useful.

Except that new is routed via a get request, and normally returns an html form which does the post which is routed to the create action.

So the xml would be asking for the form representing the "pre-populated" object to be returned in xml.

I believe the form in a typical new.erb file is just the sugar on the cake. It is the underlying object (<% form_for @some_object %>) that is interresting. Which you might want to fill in with some default values. So the xml request would not ask for the form but for the object.

It works very well with ActiveResource. ARes does not have any knowledge of the attributes available on the remote resource. The Controller#new method in that remote resource can help out by serializing the attribute names and their data types.