我有两个设计模型,个人和组。我正在尝试为注册/确认分享类似的行为(将用户发送到通知他们已发送电子邮件的页面,或在确认后将他们发送到编辑页面等)
我的问题是这仅适用于个人。它尚未适用于群组。
配置/outes.rb:
devise_for :individuals, :controllers => {:confirmations => "Confirmation", :registrations => "Registrations"}
devise_for :groups, :controllers => {:confirmations => "Confirmation", :registrations => "Registrations"}
应用程序/控制器/registrations_controller.rb:
class RegistrationsController < Devise::RegistrationsController
def after_inactive_sign_up_path_for(item)
"/post_sign_up?email=#{item.email}"
end
end
应用程序/控制器/confirmation_controller.rb:
class ConfirmationController < Devise::ConfirmationsController
def after_confirmation_path_for(name, resource)
case resource.class
when Individual then edit_individual_path resource
when Group then edit_group_path resource
else super name, resource
end
end
end
以上代码仅适用于个人。不知道为什么。