I am trying to change the path after the user changes his password following the guide on the devise documentation: Customize-the-redirect-after-a-user-edits-their-profile
Right now, I know that I have to create my own RegistrationController like
class RegistrationsController < Devise::RegistrationsController
protected
def after_update_path_for(resource)
user_path(resource)
end
end
and change the path to
def after_update_path_for(resource)
dashboard_path
end
I created the Registration Model with
rails g controller Registrations
and moved it to the app/controllers folder
Now it says that I should also configure the routes like
devise_for :users, :controllers => { :registrations => :registrations }
I am not really familiar with writing routes like that since I only use resources:, so i tried
devise_for :users, :controllers => { :registrations => 'dashboard#show' }
which gave me the error:
'dashboards#show' is not a supported controller name. This can lead to potential routing problems.
I don't quite know how I should write the routes correctly in order to change the path to dashboard_path.
Do I even generate my controller correctly?
You can use redirect_to root_path
and define the root in your ~/config/routes.rb.
You can define the root path by typing root 'dashboard#show'
(or more conventionally) root 'dashboard#index'
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.