PROBLEM: When your application grows, and your views become more complex, it can be hard to know where an element on an HTML page is rendered from.

There’s a simple solution!

Automatically annotate rails views

Just add this line:

# config/environments/development.rb
  # Annotate rendered view with file names.
--  # config.action_view.annotate_rendered_view_with_filenames = true
++  config.action_view.annotate_rendered_view_with_filenames = true

Works for:

  • templates
  • partials
  • ViewComponents !!!

Resources: