0
我是Rails的新手,並且通過一個(不太好)的教程,但是我被Rails管道阻塞了。Rails not loading bootstrap
我將gem bootstrap-sass
添加到我的Gemfile中,然後運行(從我的Rails應用程序的根目錄)bin/bundle install
。
$ bin/bundle show bootstrap-sass
出現以下響應,所以我假設自舉薩斯安裝
$ /Users/cosette/.rvm/gems/ruby-2.1.2/gems/bootstrap-sass-3.2.0.2
我修改app/assets/stylesheets/application.css
所以它看起來像:
/*
* [boilerplate text generated by rails]
*
*= require_tree .
*= require bootstrap
*= require_self
*/
現在,如果我開始up bin/rails server
:
=> Booting WEBrick
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-04-05 15:30:08] INFO WEBrick 1.3.1
[2015-04-05 15:30:08] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2015-04-05 15:30:08] INFO WEBrick::HTTPServer#start: pid=3904 port=3000
並將我的網絡瀏覽器指向http://localhost:3000/posts
,我得到Sprockets::FileNotFound in Posts#index
。這是Rails的控制檯輸出:
Started GET "/posts" for ::1 at 2015-04-05 15:31:03 -0400
ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
Processing by PostsController#index as HTML
Post Load (0.6ms) SELECT "posts".* FROM "posts"
User Load (0.5ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
Rendered collection (38.1ms)
Rendered posts/index.html.erb within layouts/application (65.2ms)
Completed 500 Internal Server Error in 124ms (ActiveRecord: 1.9ms)
ActionView::Template::Error (couldn't find file 'bootstrap'
(in /Users/cosette/Documents/workspace/rails/code/social/app/assets/stylesheets/application.css:14)):
2: <html>
3: <head>
4: <title>Social</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: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb__2483101853858498351_70166979821380'
有誰知道如何得到這個工作?謝謝。
還刪除所有'* = require xyz'指令。 – jay 2015-04-06 01:26:56