Michael Hartl教程第5章| Static_pages #home中的ArgumentError

时间:2013-06-26 05:49:13

标签: ruby-on-rails

我是Rails的新手,他们在这里关注Michael Hartl教程: http://ruby.railstutorial.org/chapters/filling-in-the-layout#fig-layout_no_logo_or_custom_css

但是当我执行page home on:localhost:3000 / static_pages / home

我收到此错误消息

ArgumentError in Static_pages#home

Showing D:/RailsPlay/sample_app/app/views/layouts/application.html.erb where line #5 raised:

different prefix: "C:/" and "D:/RailsPlay/sample_app/app/assets/stylesheets"
(in D:/RailsPlay/sample_app/app/assets/stylesheets/custom.css.scss)
Extracted source (around line #5):

2: <html>
3:   <head>
4:     <title><%= full_title(yield(:title)) %></title>
5:     <%= stylesheet_link_tag "application", media: "all" %>
6:     <%= javascript_include_tag "application" %>
7:     <%= csrf_meta_tags %>
8:     <!--[if lt IE 9]>
Rails.root: D:/RailsPlay/sample_app`

这是custom.css.scss文件的内容:

@import "bootstrap";

这是application.html.erb的内容:

<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header class="navbar navbar-fixed-top navbar-inverse">
  <div class="navbar-inner">
    <div class="container">
      <%= link_to "sample app", '#', id: "logo" %>
      <nav>
        <ul class="nav pull-right">
          <li><%= link_to "Home",    '#' %></li>
          <li><%= link_to "Help",    '#' %></li>
          <li><%= link_to "Sign in", '#' %></li>
        </ul>
      </nav>
    </div>
  </div>
</header>
<div class="container">
  <%= yield %>
</div>
</body>
</html>

我花了好几个小时没有运气,你能看出出了什么问题吗?

感谢您的帮助:)

1 个答案:

答案 0 :(得分:3)

请阅读https://github.com/rails/rails/issues/660

但我认为解决问题的最终解决方案是将项目移动到安装Rails的驱动器,以便C:\