如何让 Devise 范围发送正确的确认电子邮件模板?
我正在尝试将 Devise 与多个范围一起使用,而不覆盖 设计控制器直到我绝对需要为止。我想我可能有 达到了我最终必须重写的地步 控制器。
我有三个不同的门户/范围,称为教师, 教授、学生,他们都使用用户设计模型。每个 这些范围之一有自己的设计视图和自定义登录 模板。
我遇到的问题是我收到了相同的确认电子- 邮件模板,无论我登录的范围如何。我保留的邮件模板 getting 是我的routes.rb 文件中定义的第一个。例如:
devise_for :students, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :students
devise_for :faculty, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :faculty
devise_for :professors, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :professors
devise_for :users,
:path_names => { :sign_in => 'login', :sign_out => 'logout',:sign_up => 'signup' }
resources :users
每次我收到确认电子邮件时,它都会使用学生 确认电子邮件模板。如果我把教师调到最高层,我会得到 教师电子邮件等。
有没有办法让每个范围发送 他们各自的确认电子邮件模板,而无需 覆盖设计?
I'm trying to use Devise with multiple scopes without overriding the
Devise controllers until I absolutely have to. I think I may have
reached a point to where I finally will have to override the
controllers.
I have three different portals/scopes called faculty,
professor, and student and they all use the user devise model. Each
one of these scopes has their own devise views and custom sign in
templates.
The issue I am having is I get the same confirmation e-
mail template regardless of the scope I'm signed in. The one I keep
getting is the first one defined in my routes.rb file. For example:
devise_for :students, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :students
devise_for :faculty, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :faculty
devise_for :professors, :class_name => 'User',
:path_names => { :sign_in => 'login', :sign_out =>'logout', :sign_up => 'signup' }
resources :professors
devise_for :users,
:path_names => { :sign_in => 'login', :sign_out => 'logout',:sign_up => 'signup' }
resources :users
Every time I get a confirmation e-mail it will use the student
confirmation email template. If I move faculty to the top, I'll get
the faculty email and so on.
Is there a way to get each scope to send
their respective confirmation e-mail template without having to
override Devise?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论