【问题标题】:Webbrick won't include the correct .css fileWebbrick 不会包含正确的 .css 文件
【发布时间】:2011-11-25 21:35:56
【问题描述】:

我正在关注我遇到过的最好的教程/书籍之一,Ruby On Rails Tutorial 但我试图包含“蓝图”样式表和 assets/blueprint/screen.css 返回:

<html lang="en">
<head>
<meta charset="utf-8" />
<title>Action Controller: Exception caught</title>

我检查了文件的路径是否正确: C:\triton2\public\stylesheets\blueprint\screen.css

这是我的 application.html.erb 的顶部:

    <!DOCTYPE html>
    <html>
    <head>
     <title><%= title %></title>
      <%= csrf_meta_tag %>
      <%= stylesheet_link_tag 'blueprint/screen.css', :media => 'screen' %>
      <%= stylesheet_link_tag 'blueprint/print.css',  :media => 'print' %>
    </head>

知道是什么原因造成的吗?更好的是,我如何自己诊断正确的解决方案?除了this which recommended a db:migrate(没有帮助),谷歌上没有任何用处

[编辑] 解决方案是将样式表放在 C:\triton2\public\assets\stylesheets\blueprint\screen.css 并将 application.html.erb 更改为 'print' %>

【问题讨论】:

    标签: ruby-on-rails-3


    【解决方案1】:

    我可能错了,但我认为如果它是一个 rails 3.1 应用程序,它可能需要在 public/assets/stylesheets 而不仅仅是 public/stylesheets 中。

    【讨论】:

    • 你赢得了 A)正确和 B)我永恒的爱。这是我通过安装 Rails 3.1 的 Rails 3.0 教程得到的。
    猜你喜欢
    • 2014-05-16
    • 2017-06-04
    • 2012-07-05
    • 2015-08-08
    • 1970-01-01
    • 2019-06-14
    • 2016-08-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多