【问题标题】:content_for head tag doesn't work (ruby on rails)content_for 头部标签不起作用(ruby on rails)
【发布时间】:2014-05-17 10:17:13
【问题描述】:
<% content_for :head do %>
  <%= javascript_include_tag "http://code.jquery.com/jquery-latest.min.js" %>
<% end %>

它不起作用。

如何将html插入head标签?

谢谢。

【问题讨论】:

  • 你的head tag 中有&lt;%= yield :head %&gt; 在你的Layout 中吗?

标签: ruby-on-rails ruby


【解决方案1】:

您的&lt;head&gt; 标记中是否有&lt;%= yield :head %&gt;(可能在您的布局/application.html.erb 中)?不?然后添加它:)。

【讨论】:

    猜你喜欢
    • 2017-12-06
    • 2015-03-05
    • 1970-01-01
    • 2013-04-17
    • 2016-11-29
    • 1970-01-01
    • 2012-09-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多