Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "mail has already been taken" shows up twice on sign up with Security Extension for Devise (RoR)

I am using devise with security extension to validate strong passwords.

When I try to registrate an account with an already taken email, I get the error "email has already been taken" twice in the errors hash.

My user model looks like this:

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  # :trackable deleted
  devise :database_authenticatable, :registerable, :secure_validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :firstname, :lastname, :password, :password_confirmation, :remember_me
end

Without the security extension (:validatable instead of :secure_validatable) I get the error only once.

What am I doing wrong?


P.S. Bonus Question:

How do I prevent certain errors from being raised in the first place? Do I have to manipulate devise's RegistrationsController or is there an option for this?

like image 421
Conkerchen Avatar asked Jan 23 '13 00:01

Conkerchen


1 Answers

Had the same problem.

Check if this helps: https://groups.google.com/forum/?fromgroups=#!topic/plataformatec-devise/S0nxv7BK10M

like image 114
Andrei Zisu Avatar answered Oct 18 '22 02:10

Andrei Zisu