# When to use raise ? why just redirect\_to

**URL:** <https://www.ruby-forum.com/t/when-to-use-raise-why-just-redirect-to/172561>\
**Category:** Rails\
**Created:** [July 23, 2009, 10:07am UTC](https://www.ruby-forum.com/t/when-to-use-raise-why-just-redirect-to/172561 "2009-07-23T10:07:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubyernewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9dc877/32.png) [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Post date:** [July 23, 2009, 10:07am UTC](https://www.ruby-forum.com/t/when-to-use-raise-why-just-redirect-to/172561/1 "2009-07-23T10:07:55Z")

</div>

I don’t know what exactly raise work for. it seem redirect\_to has the  
same functionality. well, I know I must be missed something. so anyone  
show some examples?

---

<div class="post-metadata">

**Author:** ![rubyernewbie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9dc877/32.png) [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Post date:** [July 23, 2009, 10:24am UTC](https://www.ruby-forum.com/t/when-to-use-raise-why-just-redirect-to/172561/2 "2009-07-23T10:24:04Z")

</div>

On Jul 23, 9:07 am, Zhenning G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I don’t know what exactly raise work for. it seem redirect\_to has the  
> same functionality. well, I know I must be missed something. so anyone  
> show some examples?

redirect\_to makes rails generate an http redirect response (which  
tells the browser to fetch another url instead)  
raise raises an exception. The two are completely unrelated.  
If you meant render rather than redirect\_to, then the difference is  
that render just renders a template - there is no redirection.

Fred
