redner and redirect_to

Hi --

I just want to get some feedback and understanding on what the
differences are between render and redirect_to. redirect_to post the
info to the page you are redirecting to and redner simple does not post,
correct? Thanks,

It's easiest to understand if you consider that every action contains
an implicit render command:

   def show
     @item = Item.find(params[:id])
     # render the template show.rhtml
   end

So when you do:

   def show
     @item = Item.find(params[:id])
     render :template => "showme" # alternate template
   end

or:

   def show
     render :text => "No showing today!"
   end

you're just completing this request in a non-default way.

redirect_to, on the other hand, issues a whole new request. The whole
request/response cycle starts again from the beginning: a new action,
new instance variables, etc.

Here's an analogy (please ignore if unhelpful :slight_smile:

Every day you put on a shirt. You might have a default shirt for each
day -- but sometimes you might wear a non-default shirt for a given
day. Putting on a shirt is like rendering a view.

redirect_to is like it's a whole new day. The process has started
again from the beginning.

David