微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

ruby-on-rails – Ruby on Rails在资源中寻找CSS,而不是公共/样式表

我是 Ruby的新手,使用ruby 1.9.2P180和Rails 3.1.0.rc2

我在my_app_root / public / stylesheets / screen.css和我的application.html.erb中有“screen.css”

<%= stylesheet_link_tag 'screen.css',:media => 'screen' %>

根据here它应该工作,但我的rails服务器说:

Processing by PagesController#home as HTML
Rendered pages/home.html.erb within layouts/application (0.0ms)
Completed 200 OK in 4ms (Views: 3.6ms | ActiveRecord: 0.0ms)

Started GET “/assets/screen.css” for 127.0.0.1 at 2011-06-18 11:27:53 +1200
Served asset /screen.css – 404 Not Found (2ms) (pid 10966)

ActionController::RoutingError (No route matches [GET] “/assets/screen.css”):

在这里做错了什么?

提前致谢

解决方法

What am I doing wrong here?

没有什么,你只是使用认3.1安装,它使用新的基于链轮的资产管道.

将您的样式表放入/ app / assets / stylesheets中并使用

<%= stylesheet_link_tag 'application.css' %>

在你的意见

新管道将采用该文件夹中的所有样式表,并将其自动编译为单个文件.

==

或者,您可以设置在您的application.rb中关闭新的pipline

config.assets.enabled = false

原文地址:https://www.jb51.cc/ruby/271474.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐