class User < ApplicationRecord
  # Remember to create a migration!
  has_many :rounds
  has_many :guesses, through: :rounds
end

class User < ApplicationRecord
  # Remember to create a migration!
  has_many :rounds
  has_many :guesses, through: :rounds

  validates :email, presence: true, uniqueness: true
end

def password
  @password = BCrypt::Password.new(encrypted_password)
end

def password=(new_password)
  @password = BCrypt::Password.create(new_password)
  self.encrypted_password = @password
end

self.authenticate(user = {})
  @user = self.find_by(email: params[:email])

  if @user.password == params[:password]
    @user
  else
    nil
  end
end



Create reader and writer password methods, and add authentication method with some validations
Create reader and writer password methods, and add authentication method with some validations
