1
0

More than 1 year has passed since last update.

【Rails】routesのエラー「``': No such file or directory 」の対処法

Posted at

症状

railsで新たにアクションを追加しようと、routeファイルにルートを追加してサーバーを起動したところ下記のエラーが発生しました。
翻訳すると、「そのようなファイル、又はディレクトリはありません」でした

error
 rails s
=> Booting Puma
=> Rails 6.0.4.1 application starting in development
=> Run `rails server --help` for more startup options
Exiting
D:/app/config/routes.rb:28:in ``': No such file or directory - checkout (Errno::ENOENT)
        from C:/appu/config/routes.rb:28:in `block (3 levels) in <main>'
        from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/actionpack-6.0.4.1/lib/action_dispatch/routing/mapper.rb:956:in

routesファイルの該当の箇所は以下です。

routes.rb
      post `checkout`, to: `stripes#checkout`

解決方法

ルーティングしている``を''に変更することで解決しました。
ファイルがないというより、指定の仕方が悪かったからファイルがないと怒られていたようです。

routes.rb
      post 'checkout', to: 'stripes#checkout'

参考

1
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
1
0