我的Rails應用程序名稱是Card。我修改了路線並從公共目錄中刪除了index.html。當我訪問我的主頁時,仍然看到The page you were looking for doesn't exist.
。 Rake路由正確顯示根路由。Rails沒有路由匹配[GET]「/」
我使用Passenger與Apache。
[email protected]:/var/emaillenin/rails/card# cat config/routes.rb
Card::Application.routes.draw do
root :to => "home#index"
end
[email protected]:/var/emaillenin/rails/card# ls public/
404.html 422.html 500.html favicon.ico robots.txt
[email protected]:/var/emaillenin/rails/card# rake routes
root/home#index
[email protected]:/var/emaillenin/rails/card# ls app/controllers/
application_controller.rb home_controller.rb
[email protected]:/var/emaillenin/rails/card# cat app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
end
end
[email protected]:/var/emaillenin/rails/card# cat app/views/home/index.html.erb
<h1>Home#index</h1>
<p>Find me in app/views/home/index.html.erb</p>
<h1>Hello, Rails!</h1>
[email protected]:/var/emaillenin/rails/card# bundle exec rake assets:precompile
/usr/local/rvm/rubies/ruby-2.0.0-p195/bin/ruby /usr/local/rvm/gems/[email protected]/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
[email protected]:/var/emaillenin/rails/card# cat config/environments/production.rb | grep config.assets.compile
config.assets.compile = true
[email protected]:/var/emaillenin/rails/card#
這是我看到在Apache的錯誤日誌:ActionController::RoutingError (No route matches [GET] "/"):
當我做rails server
,並通過3000端口訪問我的主頁,我看到一個錯誤頁面 - http://pastebin.com/1eEU3egt
即使執行bundle exec rake assets:precompile
後我看到相同的錯誤頁面。
即使將config.assets.compile更改爲true,也會導致相同的錯誤。
任何方法來打擊這個問題?
它在使用webrick的開發中能正常工作嗎? –
什麼是您的應用/ views/home/index.html的樣子? –
@MikeCampbell更新問題。當我通過webrick嘗試時,我看到一個錯誤頁面 – emaillenin