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.
Add the following line in development.rb file to enable this feature.
config.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.

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.

Written byAkhil Gautam
Related blogs
- 01Rails 6.1 adds invert_where methodMay 4, 2021 · Chimed Palden
- 02Rails 6.1 adds in: option to validate numeric rangesApril 14, 2021 · Akanksha Jain
- 03Rails 6.1 adds delegated_type to ActiveRecordApril 6, 2021 · Akhil Gautam
- 04Rails 6.1 adds nulls_first and nulls_last to ArelMarch 9, 2021 · Berin Larson