Ruby on Rails Thursday, December 2, 2010

So instead of
----------------------------------------
respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = 'User was successfully updated.'
format.html { redirect_to(:action => 'edit') }
else
flash[:error] = 'User was not updated.'
format.html { render :action => "edit" }
end
end
----------------------------------------
Should I do this?
----------------------------------------
if @user.update_attributes(params[:user])
flash[:notice] = 'User was successfully updated.'
format.html { redirect_to(:action => 'edit') }
else
flash[:error] = 'User was not updated.'
format.html { render :action => "edit" }
end
----------------------------------------

I had the respond_to block because that's how it was programmed by the
scaffold and wasn't sure if I should remove it or not.

--
Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment