DEV Community

Discussion on: Beginner's guide to the Devise gem.

Collapse
 
scz profile image
Stef Coetzee • Edited

Hi Andrew, did you by any chance try to customize the error messages displayed when e.g. sign up fails (blank input, etc.)? For instance, one could move the error message into the label to keep the interface clear.

I don't know how to access those error messages. I've tried accessing the errors the way one would for a model, e.g. model.errors[:name] to get errors associated with the name of the model, but to no avail. Having searched online a bit, it isn't clear how to access those messages.

EDIT: Operator error. I hadn't tried targeting 'resource', I assumed it had to be 'resource_name' because of the bit right at the top of the form: "simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|". Always check assumptions!