# Response.End / Exit equivalent in Rails?

**URL:** <https://www.ruby-forum.com/t/response-end-exit-equivalent-in-rails/136596>\
**Category:** Rails\
**Created:** [May 27, 2007, 6:11pm UTC](https://www.ruby-forum.com/t/response-end-exit-equivalent-in-rails/136596 "2007-05-27T18:11:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yeago](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eada6e/32.png) [@yeago](https://www.ruby-forum.com/u/yeago)\
**Post date:** [May 27, 2007, 6:11pm UTC](https://www.ruby-forum.com/t/response-end-exit-equivalent-in-rails/136596/1 "2007-05-27T18:11:18Z")

</div>

If the user types in junk, I’d like to return the user to the original  
page.

Can’t seem to do it. How is this typically handled?

def getBody url  
begin  
open(url) do |file|  
@body = file.read  
end  
rescue SystemCallError  
flash[:notice] = ‘Check failed. This may be a bug but  
its probably just your fault.’  
render :action =\> ‘new’  
###STOP THE BOAT HERE!!!  
end  
end

---

<div class="post-metadata">

**Author:** ![yeago](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/eada6e/32.png) [@yeago](https://www.ruby-forum.com/u/yeago)\
**Post date:** [May 28, 2007, 12:42pm UTC](https://www.ruby-forum.com/t/response-end-exit-equivalent-in-rails/136596/2 "2007-05-28T12:42:58Z")

</div>

it seems getBody() is a helper ? i’d catch the exeption in the  
controller action, redirect or render the page you want. notice that  
you can’t call render more than once, but you can call return after  
the render call:

def index  
render :action=\>:one and return if params[:id].to\_i \> 10  
render :action=\>:two  
end

marcel
