Ruby on rails 在注册路径后,为不工作-设计

Ruby on rails 在注册路径后,为不工作-设计,ruby-on-rails,model-view-controller,devise,ruby-on-rails-4,rails-routing,Ruby On Rails,Model View Controller,Devise,Ruby On Rails 4,Rails Routing,我试图设计重定向到一个自定义页面后注册。它不起作用。我有以下自定义注册控制器: class RegistrationsController < Devise::RegistrationsController protected puts 'Registrations controller is happening" def after_sign_up_path_for(resource) puts 'after_sign_up_path_for is workin

我试图设计重定向到一个自定义页面后注册。它不起作用。我有以下自定义注册控制器:

class RegistrationsController < Devise::RegistrationsController
  protected

  puts 'Registrations controller is happening"

  def after_sign_up_path_for(resource)
     puts 'after_sign_up_path_for is working'
    "http://www.google.com" 
  end

  def after_inactive_sign_up_path_for(resource)
    puts 'after_inactive_sign_up_path_for is working'
   "http://www.google.com" 
  end
end
所以有趣的是注册控制器正在工作,因为第一个puts语句显示在服务器日志中。但是,第二个和第三个put语句(位于after_sign_up_path_for和after_inactive_sign_up_path_for内)没有出现


注册工作后如何获得重定向?

我建议您将这些帮助程序移动到ApplicationController(请参阅),并将它们放在公共命名空间中。

它不是重复的。我看到了这个问题,但答案对我不适用。你检查了其他答案吗?是的,我已经查看了所有堆栈溢出页和我能找到的其他资源。你是否有可能更改设计路由的默认名称?您是否在您的
routes.rb
文件中使用
designe\u scope
?不,我在上面发布的routes文件中唯一关于designe的更改。谢谢,但我不认为这是有效的,因为它不应该像在应用程序控制器中那样在每次控制器操作后都使用该方法。这只适用于返回某些页面。只有当用户尝试注册时,才应看到此方法。至少这就是我从这些关注中得到的:我试过这样做,但仍然没有成功。我在路线中看到的另一个不同点是,你试过了吗?
:registrations=>“registrations”
?字符串值?谢谢,试过了,但没用。我认为routes没有问题,因为第一个puts语句正在执行,所以route必须告诉它去那里。我认为这与“注册后”的方法有关。
devise_for :users, :controllers => { :registrations => :registrations }