Ruby on rails rails设计在邮件视图中使用帮助器
我有一张带键和值的桌子。 我想在邮件视图中显示表格中的文本 我的config/initializers/designe.rb如下所示:Ruby on rails rails设计在邮件视图中使用帮助器,ruby-on-rails,ruby,ruby-on-rails-4,devise,Ruby On Rails,Ruby,Ruby On Rails 4,Devise,我有一张带键和值的桌子。 我想在邮件视图中显示表格中的文本 我的config/initializers/designe.rb如下所示: [...] Devise::Mailer.class_eval do helper :mail_settings end end module MailSettingsHelper def get_setting(name) @value = MailSettings.where(name: name) end en
[...]
Devise::Mailer.class_eval do
helper :mail_settings
end
end
module MailSettingsHelper
def get_setting(name)
@value = MailSettings.where(name: name)
end
end
my helpers/mail_settings_helper.rb如下所示:
[...]
Devise::Mailer.class_eval do
helper :mail_settings
end
end
module MailSettingsHelper
def get_setting(name)
@value = MailSettings.where(name: name)
end
end
这种组合在普通视图上效果很好,但在我的MailviewFile中,O出现了一个错误
我的文件:app/views/designe/mailer/confirmation\u instructions.html.erb
<%
link = link_to 'Account bestätigen', confirmation_url(@resource, confirmation_token: @token)
email = get_setting('confirmation_instructions_mail')
mail = email[0].value.gsub('##EMAIL##', @email)
new_mail = mail.gsub('##LINK##', link)
%>
<%= new_mail.html_safe %>
错误是:
undefined method `get_setting' for #<#<Class:0x7cc4ac0>:0x7cfe2e8>
您重新启动服务器了吗?@SSR没有,但它可以工作,但原因是什么?当您对配置文件进行任何更改时,都需要重新加载所有配置设置。所以需要重新启动服务器。您没有重新启动服务器,它仍然工作吗?我重新启动了服务器,一切正常