rails 3, trying to confirm that an email address is in the dbm, but getting a wrong number of args error
-
24-03-2021 - |
Question
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow