轨道3 /色器件似乎忽略定制控制器 [英] Rails 3 /devise seems to ignore custom controller

查看:135
本文介绍了轨道3 /色器件似乎忽略定制控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Rails使用设计3应用程序,我已阅读维基/关于如何自定义签名后的路线文档,我使用可证实模块,所以我想我需要重写after_inactive_sign_up_path_for

Using devise with Rails 3 app, I have read wiki/docs on how to customise the after sign up route, I am using confirmable module, so I think I need to override after_inactive_sign_up_path_for

我想我所做的这一切的权利,但它完全无视我的自定义控制器和注册成功后,仍然路由到root_path。我发疯。

I think I've done it all right, but it is completely ignoring my custom controller and still routing to the root_path after sign up. Driving me nuts.

我的注册用户使用模式,我抄使用生成任务设计出意见;如果我将它们移动到的意见/注册设计回落到默认的视图(在我猜的宝石),所以它似乎并没有被'注意到'我的控制器

My registration is using User model, I have copied the views for devise using the generate task; if i move them to views/registrations devise falls back to the default views (in the gem I guess), so it seems not to be 'noticing' my controller

我有这在我的路线:

devise_for :users, :controllers => { :registrations => "registrations" }
match 'sign_up_done' => 'home#sign_up_done', :as => :after_sign_up

下面是我的控制器(控制器/ registrations_controller.rb)

Here is my controller: (controllers/registrations_controller.rb)

class RegistrationsController < Devise::RegistrationsController
  def after_inactive_sign_up_path_for(resource)
    after_sign_up_path
  end 
  def after_sign_up_path_for(resource)
   after_sign_up_path
  end
end

(由after_sign_up_path_for以防万一,使用可证实)

(Added after_sign_up_path_for just in case, using confirmable)

它只是似乎完全无视我的控制器,是命名错了吗?
感谢您的任何投入!

It just seems to completely ignore my controller, is the naming wrong? Thanks for any input!

推荐答案

我觉得你的文件夹结构可能有问题。试试这个结构:(这是相同的宝石文件夹中)

I think your folder structure may have problems. try this structure: ( it's the same as those in Gem folder)

app/controllers/devise/registrations_controller.rb
app/views/devise/registrations/new.html.erb
app/views/devise/registrations/edit.html.erb

和,因为它是在创业板上市申报文件夹控制器文件看起来是一样的:

and the controller file looks the same as it is declared in the gem folder:

#app/controllers/devise/registrations_controller.rb

# NOT: class RegistrationsController < Devise::RegistrationsController  , 
# since you are "overwriting" it. 
class Devise::RegistrationsController < DeviseController

  def after_inactive_sign_up_path_for(resource)
    #...
  end 
end

这篇关于轨道3 /色器件似乎忽略定制控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆