# Equivalent of php die()

**URL:** <https://www.ruby-forum.com/t/equivalent-of-php-die/79291>\
**Category:** Rails\
**Created:** [December 13, 2006, 10:48pm UTC](https://www.ruby-forum.com/t/equivalent-of-php-die/79291 "2006-12-13T22:48:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [December 13, 2006, 10:48pm UTC](https://www.ruby-forum.com/t/equivalent-of-php-die/79291/1 "2006-12-13T22:48:59Z")

</div>

i have a controller that is called via ajax…

if certain conditions are not met, i would like the controller to pass  
back some text and cease running the rest of the code…

something like:

```
if @forward_card.from_email.nil?
  render_text "You must include a FROM email address"
end

```

and return back to the caller…

i would like to have it die right after render\_text… and kick that  
text back to the calling function…

anyone have any ideas?

thanks!

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [December 13, 2006, 10:55pm UTC](https://www.ruby-forum.com/t/equivalent-of-php-die/79291/2 "2006-12-13T22:55:52Z")

</div>

render\_text “You must include a FROM email address” and return

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [December 13, 2006, 10:57pm UTC](https://www.ruby-forum.com/t/equivalent-of-php-die/79291/3 "2006-12-13T22:57:54Z")

</div>

On 12/13/06, Sergio R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> and return back to the caller…
> 
> i would like to have it die right after render\_text… and kick that  
> text back to the calling function…

if @forward\_card.from\_email.nil?  
render\_text “You must include a FROM email address”  
return  
end

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![spacechurro](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d2c977/32.png) [@spacechurro](https://www.ruby-forum.com/u/spacechurro)\
**Post date:** [December 13, 2006, 11:05pm UTC](https://www.ruby-forum.com/t/equivalent-of-php-die/79291/4 "2006-12-13T23:05:48Z")

</div>

> if @forward\_card.from\_email.nil?  
> render\_text “You must include a FROM email address”  
> return  
> end

that’s it!

thanks, guys…
