加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-16 19:36:17 所属栏目:百科 来源:网络整理
导读:我是 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服务
我是 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读