0

get "user/new"在 Rails 的 routes.rb 中, vs有什么区别get "user#new"

4

1 回答 1

1

据我所知:

get "user/new"

表示当您输入 url 时:localhost/user/new它将由users controlleraction处理new

"user#new"

当您希望某些特定的 url 由特定的处理controller时使用action,例如,当您打开localhost/profiles时希望它由users_controlleraction处理show

get "profile", to: "users#show"

或者,localhost/edit_profile

get "edit_profile", to: "users#edit
于 2013-08-05T10:44:17.073 回答