Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails equivalent to php die()?

Is there an equivalent in Rails to PHP's die()?

I have a case where it would make my controller code a little cleaner to set it up in a way that would sometimes call render twice, unless there is a die() that is.

like image 225
tybro0103 Avatar asked May 26 '11 19:05

tybro0103


People also ask

What can I use instead of die in PHP?

exit() will stop execution, and run any registered exit handlers.

Can you use PHP in rails?

While it's probably possible, it's a bad idea. The only time PHP should run with RoR is when it is an external source that is queried such as a PHP API that RoR consumes. By combining PHP with Ruby on Rails, you are going against what Ruby on Rails is designed for and will make your code a lot less portable.


1 Answers

abort("Message goes here") 

See: How to create an exit message

like image 58
George Cummins Avatar answered Sep 25 '22 15:09

George Cummins