When to use raise ? why just redirect_to

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?

On Jul 23, 9:07 am, Zhenning G. [email protected]
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs