Back to Blog

Rails 6.1 adds annotate_rendered_view_with_filenames for views

on July 29, 2020
This blog is part of our Rails 6.1 series.

Rails 6.1 makes it easier to debug rendered HTML by adding the name of each template used.

Rails 6.1

Add the following line in development.rb file to enable this feature.

1config.action_view.annotate_rendered_view_with_filenames = true

Now the rendered HTML will contain comment indicating the beginning and end of each template.

Here is an example.

Annotated HTML output

In the image we can see the begin and end for each of the templates. It helps a lot in debugging webpages to find out which template is rendered. Check out the pull request for more details on this.