Topic: double errors [SOLVED]

When i try to create a user with where the emails us already taken i get double errors


2 errors prohibited this user from being saved:
    Email has already been taken
    Email has already been taken

Model

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

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :first_name, :last_name, :account_id
  # attr_accessible :title, :body
  belongs_to :account
--
  validates_uniqueness_of :email, presence: true, :case_sensitive => false
  validates_uniqueness_of :username, presence: true, :case_sensitive => false
  validates :username , :length => { :in => 2..30 }

  validates :first_name, presence: true, :length => { :in => 2..20 }
  validates :last_name, presence: true, :length => { :in => 2..20 }
end

Last edited by moiseszaragoza (2012-05-24 11:50:00)

Re: double errors [SOLVED]

I believe Devise already sets up a validates_uniqueness_of :email.  Try removing your call to validates_uniqueness_of :email.

Re: double errors [SOLVED]

That does it. i was tinkling that was going to break the test but it did not

Thank you