ruby-on-rails - content_for head 标签不起作用(ruby on rails)

标签 ruby-on-rails ruby

<% content_for :head do %>
  <%= javascript_include_tag "http://code.jquery.com/jquery-latest.min.js" %>
<% end %>

它不起作用。

如何在head标签中插入html?

谢谢。

最佳答案

你有<%= yield :head %>吗在你的里面<head>标签(可能在您的 layouts/application.html.erb 中)?不?然后添加它:)。

关于ruby-on-rails - content_for head 标签不起作用(ruby on rails),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23710127/

相关文章:

ruby-on-rails - 用于测试 Rails 应用程序的 Rspec 选项

ruby-on-rails - Ruby on Rails 阻止 Turbolinks 劫持 AJAX 操作

ruby-on-rails - 如何让 unicorn 在路径下运行 Rails 3.0 应用程序?

html - rails :how to verify what kind of user log in?

MySQL 捆绑安装

ruby - 通过给定的正则表达式生成字符串

ruby-on-rails - 在 Rails 中构建多重过滤器的最佳方法

ruby - 如何展平最里面的数组

ruby - 安装 gem dm-mysql-adapter 时出现 "undefined method ` split'"

ruby-on-rails - 错误 : Nil Can't be Coerced into a Fixnum