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

Support custom error messages #16

Open
koppen opened this issue Nov 19, 2019 · 0 comments
Open

Support custom error messages #16

koppen opened this issue Nov 19, 2019 · 0 comments

Comments

@koppen
Copy link
Member

koppen commented Nov 19, 2019

Given a class

class User < ActiveRecord::Base
    validates :email, email_address { message: "denied!" }
end

I would expect

user = User.new(:email => "nope")
user.valid? #=> false
user.errors[:email] #=> ["denied!"]

but I get

user.errors[:email] #=> ["er ikke gyldig"]

where "er ikke gyldig" is the default translation for the :invalid key.

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

No branches or pull requests

1 participant