Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.1.4 broke custom messages #120

Open
donncha opened this issue Dec 6, 2021 · 5 comments
Open

v0.1.4 broke custom messages #120

donncha opened this issue Dec 6, 2021 · 5 comments

Comments

@donncha
Copy link

donncha commented Dec 6, 2021

Currently producing validation messages like "Customer Email {:message=>"is invalid"}".

Specifically, in EmailValidator

record.errors.add attribute, message: (msg % {value: value})

should revert to

record.errors.add attribute, (msg % {value: value})
@oleksiivykhor
Copy link

Yes. Previously I was getting the errors in the same as rails format record.errors[:email] # => ['is invalid'], but now it's record.errors[:email] # => [{:message=>' is invalid'}]

@stevendaniels
Copy link

It looks like this behavior was changed in #118

urbanautomaton pushed a commit to futurelearn/valid_email that referenced this issue Jun 19, 2023
A typo in hallelujah#122 appears to
have introduced an error here that's causing a large number of test
failures.

Closes hallelujah#124, closes hallelujah#123, fixes hallelujah#120
@arturoherrero
Copy link

@hallelujah Shall we close this issue after #125 was merged?

@jsocol
Copy link

jsocol commented Nov 8, 2024

I do not believe #125 would fix this issue. The errors.add API changed in Rails 6.1 to accept a hash with a message key as the second argument. Prior to 6.1, the second argument was expected to be the message itself. Later versions of Rails/ActiveModel still work with the old version of the API, though as #118 demonstrates, there's a good reason to use the new API.

@hallelujah
Copy link
Owner

hallelujah commented Nov 25, 2024

Shall we bump major version then? Fixing the issue in v0.2.1 which will be the last supporting Rails <= 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants