Short question: how can
<% content_for :title do 'Showing product' end %>
set :titlefor main layout?
Details:
We can use in the layout of the application application.html.erb
<title><%= content_for :title %>
...
<%= yield %>
and I think it yieldreturns the contents of a subpage, for example, from show.html.erbwhere it contains:
<% content_for :title do 'Showing product' end %>
How :titlecan somehow be used by something higher yield? I thought that part is evaluated first title, and then yield, since it :titlecan retroactively set the contents of a tag <title>?
source
share