[英]Ruby on Rails looks for css in assets instead of public/stylesheets
I am new to Ruby, using ruby 1.9.2P180 and Rails 3.1.0.rc2 我是Ruby新手,使用ruby 1.9.2P180和Rails 3.1.0.rc2
I have "screen.css" in my_app_root/public/stylesheets/screen.css and in my application.html.erb 我在my_app_root / public / stylesheets / screen.css和我的application.html.erb中有“screen.css”
<%= stylesheet_link_tag 'screen.css', :media => 'screen' %>
according to here it should work but my rails server says: 根据这里它应该工作,但我的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) 由PagesController#home作为HTML处理在布局/应用程序内呈现页面/ home.html.erb(0.0ms)在4ms内完成200 OK(视图: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) 在2011-06-18 11:27:53开始GET“/assets/screen.css”为127.0.0.1 +1200服务资产/screen.css - 404未找到(2ms)(pid 10966)
ActionController::RoutingError (No route matches [GET] "/assets/screen.css"): ActionController :: RoutingError(没有路由匹配[GET]“/assets/screen.css”):
What am I doing wrong here? 我在这做错了什么?
Thanks in advance 提前致谢
What am I doing wrong here? 我在这做错了什么?
Nothing, you are just using a default 3.1 install which uses the new sprockets-based asset pipeline. 没什么,你只是使用默认的3.1安装,它使用新的基于sprockets的资产管道。
put your stylesheets into /app/assets/stylesheets and use 将您的样式表放入/ app / assets / stylesheets并使用
<%= stylesheet_link_tag 'application.css' %>
in your views 在你的意见
the new pipeline takes all the stylesheets in that folder and automagically compiles them into a single file. 新管道获取该文件夹中的所有样式表,并自动将它们编译为单个文件。
== ==
Alternatively, you can set turn the new pipline off in your application.rb with 或者,您可以在application.rb中设置关闭新pipline
config.assets.enabled = false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.