Jim B
Jim B

Reputation: 217

has_secure_password validates as "can't be blank"

I'm having issues with password validation messages being displayed correctly. My form generates the correct error message, but it also displays a generic error which I don't need which states "Can't be blank". I can't find where this is coming from, but have seen that it might be linked to has_secure_password being included in the model?

user.rb

validates_presence_of :password, { message: "Please enter your password."}

new.html.erb

<% @admin.errors.messages.each do |attr, message| %>
 <li class="form-errors"><%= message.join(", ") %></li>
<% end %>

Validation display message

can't be blank, Please enter your password.

Upvotes: 1

Views: 70

Answers (1)

Franco
Franco

Reputation: 858

You are probably forgetting to permit the :password and :password_confirmation parameters in the User Controller

Upvotes: 0

Related Questions