Rails 3,尝试确认电子邮件地址在 dbm 中,但收到错误的参数数量错误

发布于 2024-12-22 12:30:20 字数 484 浏览 2 评论 0原文

我的来源位于: https://gist.github.com/f01685376a02a577a9cb

有问题的方法:

def is_valid_email?(address)
  User.find_by_email(address)
end

我认为解决方案是将 User.find_by_email(address) 的值更改为类似的值User.find_by_email(next_approver_email) = (address) 但我知道这不起作用。

Next_approver_email 是我们要根据 user.email 数据库列进行检查的内容,

有什么想法吗?

My source is at: https://gist.github.com/f01685376a02a577a9cb

the method in question:

def is_valid_email?(address)
  User.find_by_email(address)
end

I think the solution is to change the value for User.find_by_email(address) to something like User.find_by_email(next_approver_email) = (address) but I know that doesn't work.

Next_approver_email is what we are tying to check against the user.email db column

any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不羁少年 2024-12-29 12:30:21

您需要将电子邮件传递到第 5 行末尾的 is_valid_email?

def validate_each(approval, attribute, value)
   approval.errors[attribute] << "must be a valid e-mail address in our system" unless is_valid_email?(value)
end

You need to pass the email into is_valid_email? at the end of line 5

def validate_each(approval, attribute, value)
   approval.errors[attribute] << "must be a valid e-mail address in our system" unless is_valid_email?(value)
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文