author avatar

sujay

Tue Aug 06 2024

Rails templates accept any locals as arguments. However, starting from Rails 7.1, we can restrict which locals a template must accept using "Strict Locals".

// _search.html.erb

<# locals: (:url, :field_name, :placeholder) -%>

We can also set default values

<# locals: (placeholder: "Search", :url, :field_name) -%>

#rails