我有Devise设置和woking很棒.我使用确认,并根据他们的2步注册流程指南进行了修改:
我最后一个要求是我遇到了麻烦.
我们有两个场景
1)用户可以注册为新的
2)登录用户(current_user)可以创建新用户.当登录用户创建新用户时,我希望能够将他们的电子邮件添加到发送给新创建用户的确认电子邮件中
在电子邮件向我需要在current_user.email通过某种方式,如果用户通过登录的用户创建一个新的注册用户.我会那么做一个简单的,如果检查和添加一些额外的文本电子邮件.
目前,confirmation_instructions.html.erb:
<p>Welcome <%= @resource.email %>!</p>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
Run Code Online (Sandbox Code Playgroud)
我需要的是类似的东西
<p>Welcome <%= @resource.email %>!</p>
<% if !@user.email.nil? %>
<p> some additional welcome text here from <%= @user.email %> </p>
<% end %>
<p>You can confirm your account email through the link below:</p>
<p><%= link_to 'Confirm account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p>
Run Code Online (Sandbox Code Playgroud)
我一直在与自定义邮件来回奔波,没有任何快乐.有人可以帮助我,我相信这里有一些简单的东西.
对于信息(我知道这是不是最好的方式,但我们是为演示目的拼凑一个非常快速的应用程序)用户创建在上午的电子邮件地址输入一个新的联系人.如果电子邮件地址不存在于用户表存在,则创建了一个新的用户,则接触关系创建(控制器的片段):
class DashboardController < ApplicationController
before_filter …Run Code Online (Sandbox Code Playgroud)