I am a beginner. When I modified the controller, I didn't know which controller it was connected to, so I will leave it as a memorandum.
ruby:index.html.erb
<%= render 'layout/header' %> #Bad example
ruby:_header.html.erb
<%= @product.name %> #Bad example
ruby:index.html.erb
<%= render 'layout/header', product_name: @product.name %>
ruby:_header.html.erb
<%= product_name %>
That's it! !! !!
https://qiita.com/mom0tomo/items/e1e3fd29729b2d112a48
It seems that you also use locals:
. In that case, add partial:
as well.
Recommended Posts