Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate view template loading #51712

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on May 2, 2024

  1. Fix duplicate view template loading

    Currently, when rendering an ActionView::Template, the template source
    is loaded from the disk twice.
    
    During one rendering process, Template#source is called at least twice
    (once in encode! and once in strict_locals!), each of these calls runs
    @source.to_s. As @source is usually a Template::Sources::File, #to_s
    hits the disk to load the template.
    
    It is unnecessary to load the file from disk more than once just to
    check whether the "# locals:" comment is present.
    nhasselmeyer committed May 2, 2024
    Configuration menu
    Copy the full SHA
    2ed2f23 View commit details
    Browse the repository at this point in the history