# Redner and redirect\_to

**URL:** <https://www.ruby-forum.com/t/redner-and-redirect-to/110125>\
**Category:** Rails\
**Created:** [July 23, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/redner-and-redirect-to/110125 "2007-07-23T16:36:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 23, 2007, 4:36pm UTC](https://www.ruby-forum.com/t/redner-and-redirect-to/110125/1 "2007-07-23T16:36:30Z")

</div>

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,

~S

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 23, 2007, 4:58pm UTC](https://www.ruby-forum.com/t/redner-and-redirect-to/110125/2 "2007-07-23T16:58:16Z")

</div>

Hi –

On Mon, 23 Jul 2007, Shandy N. wrote:

> 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 🙂

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

–

- Books:  
RAILS ROUTING (new! [http://www.awprofessional.com/title/0321509242](http://www.awprofessional.com/title/0321509242))  
RUBY FOR RAILS ([Ruby for Rails](http://www.manning.com/black))
- Ruby/Rails training  
& consulting: Ruby Power and Light, LLC ([http://www.rubypal.com](http://www.rubypal.com))

---

<div class="post-metadata">

**Author:** ![snantz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c2a13f/32.png) [@snantz](https://www.ruby-forum.com/u/snantz)\
**Post date:** [July 23, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/redner-and-redirect-to/110125/3 "2007-07-23T18:18:16Z")

</div>

That makes perfect sense and explains why when I was trying to retreive  
data from the parameters hash that nothing was there. I’m new to RoR and  
it seems like every now and then I discover a little quark that throws  
me for a loop. Your book, by the way, was one of the books that I read  
to learn RoR - very well written. Thanks again,

~S
