📜 ⬆️ ⬇️

Help debugging templates on Rails

Rails is a great framework, but debugging applications on it is usually not such a trivial action. IDE is not sharpened by this, so everything is done manually. Often, debugging inside Views is based on <%= debug @ %> . It turns out that there is a plugin that makes it easier to do this. It is called debug_view_helper and was created to simply add debug information to the view templates. It allows you to view:


It is quite old and is installed directly from svn:
svn co www.realityforge.org/svn/code/debug-view-helper/trunk vendor/plugins/debug_view_helper



')
In use, it is extremely simple. You just need to add the code in your header or footer:
<% if RAILS_ENV == 'development' %><br/>
<br/>
<br/>
Show debug popup<br/>
<br/>
<br/>
<%= debug_popup %><br/>
<% end %><br/>


The code will add a button that will open a window with all the data described above. In order to display all the data directly on the page, you can do this:
<% if RAILS_ENV == 'development' %><br/>
<%= debug_inline %><br/>
<% end %><br/>

Source: https://habr.com/ru/post/28966/


All Articles