Skip to content

Make template locals available as a hash to the template itself #18962

Closed
@dhh

Description

@dhh

This is a common piece of code:

# Template 1
<%= render 'some/partial', magic: variable %>

# Template 2
<%= render 'some/partial' %>

# some/partial
<%= defined?(magic) ? magic : '' %>

That defined? check is pretty gross. I'd much rather be able to do:

# some/partial
<%= locals[:magic] %>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions