ruby-on-rails - 如何使 DecentExposure gem 在邮件上工作?
问题描述
我正在尝试expose
在 Ruby on Rails 邮件程序中包含 Decent Exposure 方法,但我不断收到此错误:NoMethodError - undefined method params' for #
我知道 gem 正在寻找控制器参数,这些参数在 ActionMailer 中不可用。但是,他们的文档说它适用于邮件程序。
我的代码与他们文档中的代码非常相似:
class UserMailer < ApplicationMailer
expose(:user)
def welcome_email(id:)
mail(to: user.email, from: "...", subject: "...")
end
end
我正在使用 Ruby 2.5.0、Rails 5.0.7.2 和 DecentExposure 3.0.0
解决方案
推荐阅读
- elasticsearch - ElasticSearch - FILTER 的可选参数?
- node.js - 当我尝试创建反应应用程序时,我得到“未提供模板,这可能是因为您使用的是过时版本的 create-react-app”错误
- java - 使用时获取 NPE
在 Hibernate 5.2.11 中的 HBMXML 中 - c# - Asp.NET Core 3.1 RazorPages 本地化 SEO 友好的 URL
- bash - 如何使用多个变量并行运行多个 curl 请求
- html - Angular 6如何在html的表格行上正确应用条件
- c# - Entity Framework Core 1:n 关系导致循环
- r - 使用 `future_lapply()` 时如何将消息打印到控制台?
- javascript - 如何在 Node.js 中将 Markdown 解析为 HTML 树?
- flutter - listView 中的分组单选按钮