Ruby on rails ActionView::Template::Error(没有路由匹配{}缺少必需的键:[:id])

Ruby on rails ActionView::Template::Error(没有路由匹配{}缺少必需的键:[:id]),ruby-on-rails,heroku,Ruby On Rails,Heroku,错误是: ActionView::Template::Error(没有路由匹配 {:action=>“show”,:controller=>“users”,:id=>#}缺少必需的键:[:id]): 我认为问题在于html代码: <%= link_to 'Profile', user_path(current_user) %> <%= link_to 'Upload Meter Data', user_path(current_user) %> 如何解决这个问题

错误是:

ActionView::Template::Error(没有路由匹配
{:action=>“show”,:controller=>“users”,:id=>#}缺少必需的键:[:id]):

我认为问题在于html代码:

 <%= link_to 'Profile', user_path(current_user) %>

 <%= link_to 'Upload Meter Data', user_path(current_user) %>
如何解决这个问题

resources :users, only: [:show],  constraints: { id: /\d/ }
试试这个:

/\d/ change to /\d+/
/\d/ change to /\d+/