レイアウトを使用するレールアプリがあります
簡易版は次のようになります。
<html>
<head>
<%= render 'layouts/head' # renders the "layouts/_head.html.erb" partial correctly
# the most head (css/js) content gets implemented here %>
</head>
<body>
<%= yield # renders the current action %>
<!-- implement alls scripts which should be exectued on the bottom of the page -->
<%= content_for :scripts_bottom %>
</body>
</html>
私の `layouts/_head.html.erb' で使用します
<%= content_for :scripts_head %>
<!-- it seems `content_for` instead of `yield` appends content -->
私partials
の場合、次のスニペットを配置して追加します:scripts_head. (一部のパーシャルは javaScripts を配置する必要があります
<% content_for :scripts_head do %>
<%= javascript_include_tag 'some_script' %>
<% end %>
`layouts/head' の content_for は何もレンダリングしません
どうすれば解決できますか?
エコーする content_for / yield タグの後ろに配置されているpartials
場合、 content_for コンテンツを追加できないようです。content_for :blah do
試しcontent_for :scripts_bottom
てみると、ページの下部にレンダリングされます。
前もって感謝します
レール 3.2.14 ルビー 2.0.0p247