0
我想要的色器件文檔上的導向下,用戶改變他的密碼後才能更改路徑後:Customize-the-redirect-after-a-user-edits-their-profileRails的設計重定向用戶編輯自己的密碼
現在,我知道我要創建我自己的這個RegistrationController像
class RegistrationsController < Devise::RegistrationsController
protected
def after_update_path_for(resource)
user_path(resource)
end
end
,改變路徑
def after_update_path_for(resource)
dashboard_path
end
我創建的註冊模型
rails g controller Registrations
,並移動到應用程序/控制器的文件夾現在
它說,我還應該配置像
devise_for :users, :controllers => { :registrations => :registrations }
路由我不是真正熟悉,因爲我的寫作路線一樣,只使用資源:,所以我嘗試
devise_for :users, :controllers => { :registrations => 'dashboard#show' }
它給我的錯誤:
'dashboards#show' is not a supported controller name. This can lead to potential routing problems.
我不太清楚應該如何正確編寫路徑才能更改到dashboard_path的路徑。
我甚至能正確生成我的控制器嗎?
我想你應該只是按照文檔。它說: 'devise_for:users,:controllers => {:registrations => CONTROLLER_NAME}'not'devise_for:users,:controllers => {:registrations => CONTROLLER_NAME + ACTION_NAME}' –