I donβt know if there is a stone for this, but you can rewrite the class intended for rendering the output of all views and partitions located in:
.bundle/ruby/ruby-2.3.1/gems/action-view-4.2.5.1/lib/action_view/template.rb (replace the version number)
There is a method called def compile(mod) owerwrite to add your own lines that you want to represent in the view. For your case, you can do something like this:
def compile(mod)
Added code:
code.insert(63, "@output_buffer.safe_append='\n\n'.freeze\;") code.insert(code.size-19, "@output_buffer.safe_append='\n\n'.freeze\;")
And it will display all partial and all representations in the views as they are rendered.
The result will look like this:
Your text on the page
If you want to extract this into a separate class, create a new initialization file in the config/initializers/ directory of the Rails project, which is called, for example, render_override.rb , and paste the code something like this:
ActionView::Template.class_eval do
Reboot the server so that the changes can be picked up, and now your views will be displayed with these new settings.
You might want to surround your eval class with the RAILS_ENV='dev' check or something similar so that it can only be started during development and you are ready to go.
Aleks source share