私は sixrevision.com のチュートリアル「Ruby on Rails を使用してゼロからブログを作成する方法」に取り組んでいます。Rails 2.x から 3.x に変換しようとしています。localhost:3000 を実行すると、次のようになります。
Routing Error
uninitialized constant PostController
Try running rake routes for more information on available routes.
Rake Routes は私にこれを示しています:
posts GET /posts(.:format) posts#index {:has_many=>:comments}
POST /posts(.:format) posts#create {:has_many=>:comments}
new_post GET /posts/new(.:format) posts#new {:has_many=>:comments}
edit_post GET /posts/:id/edit(.:format) posts#edit {:has_many=>:comments}
post GET /posts/:id(.:format) posts#show {:has_many=>:comments}
PUT /posts/:id(.:format) posts#update {:has_many=>:comments}
DELETE /posts/:id(.:format) posts#destroy {:has_many=>:comments}
/:controller/:action/:id(.:format) :controller#:action
/:controller/:action/:id.:format :controller#:action
root / post#index
私の routes.rb ファイル:
Myblog::Application.routes.draw do
resources :posts, :has_many => :comments
match ':controller/:action/:id'
match ':controller/:action/:id.:format'
root :to => "post#index"
end
誰かが何か考えましたか?興味と助けをありがとう!