Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do i display devise sign_up page error messages ?

sasky621 asked in Rails

I have a problem that whenever iam trying to sign_up and leave all fields empty i don't get any errors like "password can't be empty"..
but after refreshing the page and resubmit the same data i get the errors displayed on the page..in short in order to display sign_up errors i need to refresh the sign_up page a couple of times .. how can i solve this .. and i make sure that i have this line "<%= render "devise/shared/error_messages", resource: resource %>" , in "new.html.erb" file .. and the devise shared error partial contains the following code:
<% if resource.errors.any? %>



<%= I18n.t("errors.messages.not_saved",
count: resource.errors.count,
resource: resource.class.model_name.human.downcase)
%>



    <% resource.errors.full_messages.each do |message| %>
  • <%= message %>

  • <% end %>


<% end %>

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.