1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

railsのpathヘルパーを変更

Last updated at Posted at 2021-02-06

はじめに

railsのpathヘルパーの変更方法を備忘録的に書きました。

変更方法

例えば下記のルート定義の場合

get '/login', to: 'users#login'

pathヘルパーはlogin_pathとなります。
スクリーンショット 2021-02-06 21.52.47.png

例えばusers_login_pathに変更したい時はasを使って下記のように変更できます。

get '/login', to: 'users#login', as: :users_login

pathヘルパーがusers_login_pathになりました。
スクリーンショット 2021-02-06 22.04.57.png

参考

Railsドキュメント

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?