【发布时间】:2012-09-03 07:02:42
【问题描述】:
欢迎 xxx@xxxxx.com!您可以通过以下方式确认您的帐户电子邮件 下面的链接:在此处输入代码确认我的帐户
我想把这条消息编辑成这样
我的项目名称 你好xxxxx 单击此处确认您的电子邮件
【问题讨论】:
标签: ruby-on-rails devise-confirmable
欢迎 xxx@xxxxx.com!您可以通过以下方式确认您的帐户电子邮件 下面的链接:在此处输入代码确认我的帐户
我想把这条消息编辑成这样
我的项目名称 你好xxxxx 单击此处确认您的电子邮件
【问题讨论】:
标签: ruby-on-rails devise-confirmable
只需生成设计视图
rails g 设计:视图
然后您可以访问默认的邮件配置
your_app/app/views/devise/mailer
【讨论】:
your_app/app/views/user/mailer 和 your_app/app/views/admin/mailer。 ..
检查devise.en.yml 以查找设计翻译。您可以将project_name 传递给翻译;例如:
t('welcome', :project_name => project.name)
并且在 yml 文件中:
welcome_message: 'My %{project_name} Hello xxxxx click here to confirm you email'
【讨论】:
当资源通常是 users 或 admin
时,我相信您想从app\view\resource\mailer 自定义 confirmation_instructions.html.erb 文件
首先,检查您是否在config/initializers/devise.rb 中设置了config.scoped_views = true 多亏了这一点,安装程序正在资源的视图文件夹中查找模板,而不是app\views\devise\mailer 中的默认模板
使用login、username等可以通过以下方式<%= @resource.login %>
毕竟,请确保重新启动服务器。供参考,检查类似问题Ruby/Rails: How do you customize the mailer templates of Devise?
【讨论】: