LoginSignup
0
0

More than 3 years have passed since last update.

Railsで起きたRoutingErrorの対処について

Posted at

RailsでRoutingErrorが起きた。

今回の対処法

至って問題はシンプルで、<%= %>内のpathに問題があった。

具体的には

example.html.erb
<%= link_to "Delete", post_path(@post), method: :delete, data:{confirm: "Are you sure?"}, class:"button is-danger" %>

としないといけなかったところで、

example.html.erb
<%= link_to "Delete", edit_post_path(@post), method: :delete, data:{confirm: "Are you sure?"}, class:"button is-danger" %>

としてしまっていた。

今後の対策

RoutingErrorが起きたら、まずPathを確認する。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0