安装bootstrap
gem之后再次运行rails server
我收到此错误:
NoMethodError in Pages#welcome
undefined method `environment' for nil:NilClass
(in /Users/neilpatel/Desktop/Rails/prospects/app/assets/stylesheets/custom.css.scss)
@import "bootstrap";
<!DOCTYPE html>
<html>
<head>
<title>Prospects</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>
<%= link_to "Home", "/" %>
<%= link_to "About", "/about" %>
<%= yield %>
</body>
</html>
Processing by PagesController#welcome as HTML
Rendered pages/welcome.html.erb within layouts/application (0.1ms)
Completed 500 Internal Server Error in 15ms
ActionView::Template::Error (undefined method `environment' for nil:NilClass
(in /Users/neilpatel/Desktop/Rails/prospects/app/assets/stylesheets/custom.css.scss)):
4: <head>
5: <title>Prospects</title>
6:
7: <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
8: <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
9:
10: <%= csrf_meta_tags %>
app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___3923576615849785590_70354614228980'
source 'https://rubygems.org'
gem 'rails', '4.0.0.rc1'
gem 'sqlite3'
gem 'sass-rails', '~> 4.0.0.rc1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 1.0.1'
gem 'bootstrap-sass', '~> 3.1.1'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
更新了gemfile 运行捆绑更新
'ran bundle update Bundler could not find compatible versions for gem "railties":
In Gemfile:
sass-rails (~> 4.0.2) ruby depends on
railties (< 5.0, >= 4.0.0) ruby
rails (= 4.0.0.rc1) ruby depends on
railties (4.0.0.rc1)