-1
我在那里我试图表现出的个人资料页面的导航条。不过,我一直在遇到一些问题。配置文件是通过有一项登录和创建等,因此用户无法创建登录后一个。我只希望行动能看到他们的个人资料,并编辑自己的个人资料。我一直有这个问题,任何人都可以快速查看?NoMethodError未定义的方法`user_path`
当我rake routes
I型风越来越
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
,因此我会在我的layouts
文件希望能有:
= link_to 'Profile', users_path(@user_id)
如果我在users_path
有它,我得到一个错误,说明undefined method 'users_path'
。如果我切换到user_path
我得到一个no route matches
我的路线文件看起来像(这是整个文件)
Rails.application.routes.draw do
devise_for :users
get 'welcome/index'
root 'welcome#index'
resources :users, :only => [:show, :edit]
end
我的控制,我有:
def show
@user = User.find(params[:id])
end
最后我的看法载在高达"users/show"
(我不认为这就是问题的,但我觉得分享的那部分也一样)