users_path
和user_path(user1)
我想前者去索引动作,后者去特定用户的show动作
答案 0 :(得分:2)
您的期望是正确的:
users_path
在
users#index
的路径
user_path(user1)
提供控制器操作users#show
的路径,其中params[:id]
设置为user1.id
答案 1 :(得分:0)
users_path returns /users
new_user_path returns /users/new
edit_user_path(:id) returns /users/:id/edit (for instance, edit_user_path(10) returns /users/10/edit)
user_path(:id) returns /users/:id (for instance, user_path(10) returns /users/10)
了解更多详情 http://guides.rubyonrails.org/routing.html#crud-verbs-and-actions
答案 2 :(得分:0)
users_path will routes to users#index as you expected
并且
user_path(user) will redirect to users#show if method is get
或
It will redirect or routes to users#destroy if method is delete