访问:http://192.168.1.117:3000/static_pages/home,,本程序是按照Ruby出现如下错误 on Rails Tutorial 原书第 2 版 第 5 章写的
application.html.erb 文件
<!DOCTYPE html>
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all","data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
</head>
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
<%= render 'layouts/footer' %>
</div>
</body>
</html>
development.log 文件
Started GET "/static_pages/home" for 192.168.1.104 at 2014-05-01 06:54:06 +0000
Processing by StaticPagesController#home as HTML
Rendered static_pages/home.html.erb within layouts/application (16.2ms)
Completed 500 Internal Server Error in 348ms
ActionView::Template::Error (undefined method `environment' for nil:NilClass
(in /home/vagrant/rails_projects/sample_app10/app/assets/stylesheets/custom.css.scss)):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", media: "all","data-turbolinks-track" => true %>
6: <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
7: <%= csrf_meta_tags %>
8: <%= render 'layouts/shim' %>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___983202441__584663748'
Rendered /home/vagrant/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.8ms)
Rendered /home/vagrant/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (58.7ms)
Rendered /home/vagrant/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/gems/actionpack-4.0.4/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (79.8ms)