How can I add errors to the User
model manually?
Is it just @user.errors << "some text goes here"
?
Steps for Custom Error PageCreate a separate folder for Error. Add Web Form for custom error page. Set <customErrors> setting in Web. Config file of the application.
@user.errors.add(:email, "Not valid")
If you don't want to use any attributes, then in your model
@user.errors[:base] << "This person is invalid because ..."
For details: link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With