Leonel *.* wrote in post #965713:
> Marnen Laibow-Koser wrote in post #965706:
>> Leonel *.* wrote in post #965703:
>>> 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
>>> ----------------------------------------
>>
>> If you did that, where would the local variable "format" be defined?
>>
>
> Well, you're right, but Edmond said:
> "But you have already answered this part by removing the xml section.
> Then, I'm sure your code contains no *respond_to* block. It looks very
> clean that way (unless you want your app to respond conditionally to
> HTTP requests send to it."

That doesn't mean you can remove it with no other modifications.  You've 
got to understand the Ruby syntax, not just use it like a cookbook. :)

If you want to try it, go ahead.  And watch your automated tests turn 
bright red...

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]

-- 
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 [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.

Reply via email to