lib/action_view/base.rb in actionview-7.1.5 vs lib/action_view/base.rb in actionview-7.2.0.beta1

- old
+ new

@@ -78,10 +78,27 @@ # Headline: <%= local_assigns[:headline] %> # # This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use # <tt>defined? headline</tt> to first check if the variable has been assigned before using it. # + # By default, templates will accept any <tt>locals</tt> as keyword arguments. To restrict what <tt>locals</tt> a template accepts, add a <tt>locals:</tt> magic comment: + # + # <%# locals: (headline:) %> + # + # Headline: <%= headline %> + # + # In cases where the local variables are optional, declare the keyword argument with a default value: + # + # <%# locals: (headline: nil) %> + # + # <% unless headline.nil? %> + # Headline: <%= headline %> + # <% end %> + # + # Read more about strict locals in {Action View Overview}[https://guides.rubyonrails.org/action_view_overview.html#strict-locals] + # in the guides. + # # === Template caching # # By default, \Rails will compile each template to a method in order to render it. When you alter a template, # \Rails will check the file's modification time and recompile it in development mode. # @@ -254,10 +271,11 @@ ArgumentError, argument_error. message. gsub("unknown keyword:", "unknown local:"). gsub("missing keyword:", "missing local:"). - gsub("no keywords accepted", "no locals accepted") + gsub("no keywords accepted", "no locals accepted"). + concat(" for #{@current_template.short_identifier}") ) end else public_send(method, locals, buffer, &block) end