0

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

但是当我在以下位置执行页面主页时: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>

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

感谢您的帮助 :)

4

1 回答 1

3

阅读一下https://github.com/rails/rails/issues/660

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

于 2013-06-26T06:27:26.093 回答