0
私はレールアプリを持っています。ルーティングとフォルダ構造は以下の通りです。私はpost_comment_reply
を作成しようとすると、私はこのエラーを取得:レール付き高度配線モジュール
Started POST "/post_comments/114/post_comment_replies" for ::1 at 2016-03-21
ActionController::RoutingError - uninitialized constant Post::PostCommentRepliesController
それはPost::PostCommentRepliesController
代わりのPosts::PostCommentRepliesController
を言っていることを奇妙です。私のコントローラは次のように見えますclass Posts::PostCommentRepliesController < ApplicationController
なぜこのようなことが起こっているのか教えてください。
resources :posts do
resources :post_comments, only: [:create, :update, :destroy], module: :posts
end
resources :post_comments, only: [] do
resources :post_comment_replies, only: [:create, :update, :destroy], module: :posts
end
コントローラフォルダ構造:
controllers
posts
post_comments_controller.rb
post_comment_replies_controller.rb
ビューのフォルダ構造
views
posts
post_comments
...html.erb
post_comment_replies
...html.erb
追加情報を追加しました。それをチェックできますか? –
私はroutes.rbイヤラーの誤字を訂正しましたが、サーバを再起動する必要がありました。私はなぜルートが再起動せずに動作しているのかわからない。 –
いいえ、ルートを変更すると、すべてのバージョンのレールでサーバを再起動する必要があります。/configで変更されたものはすべて、サーバーを再起動する必要があります。 –