Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
801 views
in Technique[技术] by (71.8m points)

ruby on rails - overriding devise after_sign_up_path_for not working

In routes i have the root-path pointing "home#index" but when i try to override that with after_sign_up_path_for keeps redirecting me to the root path when I sign in or sign up. I have tried to put it in both in devise subclassed controller and application_controller, but it didn't work. What do I need to do here?

Application controller

class ApplicationController < ActionController::Base
  protect_from_forgery

  def after_sign_up_path_for(resource)
    show_cities_path(resource)
  end
end

registration controller

class RegistrationsController < ApplicationController
  def after_sign_up_path_for(resource)
    show_cities_path(resource)
  end
end

routes

root :to => "home#index"
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you also have the Confirmable module enabled, you have to override after_inactive_sign_up_path_for since a new sign-up is "inactive" until it's confirmed. after_sign_up_path_for doesn't seem to get called when Confirmable is active.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...