I use php and there is a handy exit; that will stop the execution of the page and let me view the page thus far and then lets me view the debugging that i need ..anything like that in ruby on rails
A direct mapping to PHP's exit function would be Kernel::exit() (or simply exit())
Specifically in a Rails view: <%= debug @whatever %>
. More Info
The best method for debugging in rails is to start your server with debugging enabled ruby script/server --debugger
(this requires the ruby-debug gem) gem install ruby-debug
You can then put <% debugger %>
in your views, controllers or wherever you like (obviously omit the erb tags if outside of a view). the terminal you have the server running in will then show you a breakpoint debugger help
from the prompt there will tell you more.
You can do raise an exception in your code which stops the current method and prints the exception. Great for debugging.
For example raise @variable.inspect
. Also calling the inspect method will show you a lot of information about your variable. Also you can use this in your views controllers models helpers if you are using rails.
In your view:
<%= raise @variable.inspect%>