我的 Rails 应用程序名称是 Card。我已经修改了路线并从公共目录中删除了 index.html。The page you were looking for doesn't exist.
当我访问我的主页时,我仍然看到。Rake 路由正确显示根路由。
我正在使用带有 Apache 的乘客。
root@emaillenin:/var/emaillenin/rails/card# cat config/routes.rb
Card::Application.routes.draw do
root :to => "home#index"
end
root@emaillenin:/var/emaillenin/rails/card# ls public/
404.html 422.html 500.html favicon.ico robots.txt
root@emaillenin:/var/emaillenin/rails/card# rake routes
root / home#index
root@emaillenin:/var/emaillenin/rails/card# ls app/controllers/
application_controller.rb home_controller.rb
root@emaillenin:/var/emaillenin/rails/card# cat app/controllers/home_controller.rb
class HomeController < ApplicationController
def index
end
end
root@emaillenin:/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>
root@emaillenin:/var/emaillenin/rails/card# bundle exec rake assets:precompile
/usr/local/rvm/rubies/ruby-2.0.0-p195/bin/ruby /usr/local/rvm/gems/ruby-2.0.0-p195@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
root@emaillenin:/var/emaillenin/rails/card# cat config/environments/production.rb | grep config.assets.compile
config.assets.compile = true
root@emaillenin:/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 也会导致相同的错误。
有什么办法可以解决这个问题?