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.
exit() will stop execution, and run any registered exit handlers.
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.
abort("Message goes here")
See: How to create an exit message
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With