Rails5.1.3でWebアプリケーション制作の勉強をしています。
link_toで呼び出すURLコードは間違っていないと思うのですがUrlGenerationError No route matches が
発生してしまいます。解消方法を教えていただけないでしょうか?
エラー内容は以下になります。
エラー内容 ActionController::UrlGenerationError in Staff::Top#index Showing /home/vagrant/chibi/chibi/app/views/staff/top/dashboard.html.erb where line #31 raised: No route matches {:action=>"not_payment", :controller=>"staff/registers", :host=>"example.com"}, missing required keys: [:register_id] Extracted source (around line #31): 29 </li> 30 <li><%= link_to '終了会員数', :prefecture_member_staff_record %></li> 31 <li><%= link_to '次月会員一覧', :staff_register_not_payment %></li> 32</ul>
registers_controller.rb def not_payment time = Time.zone.now @month = time.month . . .
routes.rb resources :registers do get :not_payment end
コンソールで確認 $ rails routes staff_register_not_payment PATCH /staff/registers/:register_id/not_payment(.:format) staff/registers#not_payment {:host=>"example.com"}
dashboard.html.erb <li><%= link_to '次月会員一覧', :staff_register_not_payment %></li>
のように記述していますが No route maches エラーが出てしまいます。
どなたか間違いを指摘していただけないでしょうか?宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。