<分区>
最近发现我的程序在 localhost:3000 服务器上遇到大量错误。我对 Ruiby on Rails 和 jQuery 还很陌生,但我意识到这是一个特定于 Windows 的错误,我相信我的程序到目前为止没有任何真正的错误。
我的 rails 版本是最新的 (5.0.0.1),我的 ruby 版本是 2.2.4,目前每当我启动本地主机时,我都会收到此错误:
TypeError: Object doesn't support this property or method
<head> <title>Blog</title> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> <%= csrf_meta_tags %> </head>
但是,似乎每当我将“应用程序”标签更改为我想要的任何内容时,它似乎都能正常运行并正确运行本地主机。例如,我将其更改为“默认”。
<%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'default', 'data-turbolinks-track': 'reload' %>
现在通常 application.css 代码应该自动实现到我的 View 中,但现在不起作用,因为我将上面的标签更改为“默认”。为了解决这个问题,我首先尝试使用
<%= stylesheet_link_tag "default" %>
但返回相同
TypeError: Object doesn't support this property or method
之后,我决定创建一个名为“default.css”的新 CSS 文件以匹配 application.html.erb 代码。仍然返回相同的 TypeError 问题。
我已经无数次重新运行 bundle install,检查了我所有的 gem,创建了新元素,但这个问题仍然存在。