class User < ActiveRecord::Base
  include BCrypt
  validates :email, :password_hash, presence: true
  validates :email, length: { minimum: 1 }
  validates :email, uniqueness: true
  has_many :projects

  def password
    @password ||= Password.new(password_hash)
  end

  def password=(new_password)
    @password = Password.create(new_password)
    self.password_hash = @password
  end

end

class User < ActiveRecord::Base
  has_secure_password
  validates :email, :password_digest, presence: true
  validates :email, length: { minimum: 1 }
  validates :email, uniqueness: true
  has_many :projects
end
Add has_secure_password to User model for newer Rails-Bcrypt integration. Remove unneeded Bcrypt User model methods. Change User model validation to check :password_digest instead of :password_hash.
Add has_secure_password to User model for newer Rails-Bcrypt integration. Remove unneeded Bcrypt User model methods. Change User model validation to check :password_digest instead of :password_hash.
