On 11 January 2011 23:45, Garrett Lancaster <[email protected]>wrote:
> def create > @user = User <http://apidock.com/rails/User>.new > <http://apidock.com/rails/ActionController/Responder/new/class>(params[:user]) > flash[:notice] = 'User was successfully created.' if @user.save > respond_with(@user) > end > > is the same as: > > def create > @user = User <http://apidock.com/rails/User>.new > <http://apidock.com/rails/ActionController/Responder/new/class>(params[:user]) > > respond_to do |format| > if @user.save > flash[:notice] = 'User was successfully created.' > format.html { redirect_to(@user) } > format.xml { render :xml => @user, :status => :created, :location => > @user } > else > format.html { render :action => "new" } > format.xml { render :xml => @user.errors, :status => > :unprocessable_entity } > end > end > end > > It's just built into the method. > > where did you get this information? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" 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-talk?hl=en.

