diff between redirect_to :action and calling action/rend

Cayce Balara wrote:

Thanks for the quick response, Frederick.


In first case the URL in the browser will say:

  Login | HSTS Redirection Community

and in the second it will say:

  Login | HSTS Redirection Community?

But otherwise the net result of what code is processed and what content is displayed is the same?

Thanks. c.

....uhm... not exactly.

- redirect_to makes the browser load a new page, and the result is the same as if the user manually nagivated to this URL or entered it in the address field of his browser. so to stick to your example: once the browser has requested the new page he has been redirected to (controller/list), the "list" action will be executed, and then the corresponding view will be parsed and filled with the data made available to it in the action.

- render will only render the view of the "list" action (list.rhtml) without calling the "list" action first. So you would have to make some data availabe in the index action that can be parsed in the "list" view file, which would not be very DRY (Don't repeat Yourself)