dashboards#show
如果我按原样使用以下代码Couldn't find Dashboard without an ID
(user_dashboard_path(current_user, current_user.dashboard)
rb)。
我想我需要将用户传递到设置根路径的代码块中,但我不确定这将如何完成。
有小费吗?
这是我的整个 routes.rb 文件:
MyApp::Application.routes.draw do
resources :users do
resources :dashboards, only: [:show, :edit, :update, :destroy]
end
authenticated :user do
# Instead of the show action, I want to go to user_dashboard which is
# GET /users/:user_id/dashboards/:id(.:format) dashboards#show
root :to => "dashboards#show", as: :authenticated_root
end
root :to => "home#index"
devise_for :users, :controllers => { :registrations => :registrations }
end