Template Locals in Rails 7.1 Discussion
This is a great addition to Rails. It makes partials feel a lot like calling methods with required and optional arguments.
Couple of nice little Easter Eggs at the end there. Love it!
One thought I had was whether the template locals can be passed into the shorthand when called render.
ie. can
<%= render @product %>
handle
<%= render @products, comment_count: 2 %>
or do we need to revert back to
<%= render partial: "product", product: @product, comment_count: 2 %>
or even
<%= render partial: "product", locals: { product: @product, comment_count: 2 } %>
Hard to tell when reading the docs.
Sometimes I prefer to just do the long way everywhere with partial:
and locals:
just so I am not getting confused by the magic.
Sorry still can't edit comments. I click edit from the comment action menu drop down and I get redirect to https://gorails.com/dashboard with a flash 'You are not authorized to perform that action'.