Ruby BCrypt hash comparison not working
<p>I am a new comer to Ruby, so apologies if this question has already been answered. I have read the other questions and still cannot figure out what I am doing wrong.</p>

<p>I am creating hashed passwords for storing in a db like this:</p>

<pre><code>new_user.password = BCrypt::Password.create(unhashed_password)
# Write the user to database
new_user.store_user
</code></pre>

<p>I then retrieve the user from the db by checking against the inputed user name, and then check the password like this:</p>

<pre><code># Get user from the database
def self.get_user(check_user_name)
db = User.open_db
user = User.new
user_arr = db.execute("SELECT * FROM user_data WHERE user_name = ?", check_user_name).first
db.close
# if the user exists check the password
if user_arr.size != 0
  print "Enter your password  : "
  # Get password from user
  user_input_password_attempt = gets.chomp
end
# Parse the db user into a user class if password guess is correct
stored_password = BCrypt::Password.new(user_arr[2])
if user_input_password_attempt == stored_password
  @@users_logged_in += 1
  user.user_id = user_arr[0]
  user.user_name = user_arr[1]
  user.password = user_arr[2]
  return user
end
:no_user
</code></pre>

<p>end</p>

<p>My problem is that the var stored_password is returning a hash and != user_input_password_attempt
I have read the Ruby-Doc and googled this extensively</p>