Render or redirect_to?


#1

When would I use a render and when would I use a redirect_to? It seems
that
a redirect_to would be so much more common, but there has been an
emphasis
on rendering in rails

John McClain
Senior Software Engineer
TCS Healthcare
removed_email_address@domain.invalid
(530)886-1700x235
“Skepticism is the first step toward truth”


#2

On 12/23/05, John MccLain removed_email_address@domain.invalid wrote:

When would I use a render and when would I use a redirect_to? It seems that
a redirect_to would be so much more common, but there has been an emphasis
on rendering in rails

render() means “User got to the right place, and now it’s time to
generate HTML for them to display.”
redirect_to() means “We can’t handle things in this action/controller,
so we’re telling the user’s browser to go elsewhere.”

Put another way, render() produces results without changing the URL
displayed in the client browser, redirect_to() sends them elsewhere.

–Wilson.