title: bcrypt LoadError: Cannot load such file
body: <p>I'm trying to set up a login function for my Rails app, I'm getting a bcrypt error message when I press the login button:</p>
  
  <pre><code>LoadError in SessionsController#create
  cannot load such file -- bcrypt
  </code></pre>
  
  <p>Is anyone else getting this error? I have the latest version of bcrypt and I'm following exactly what the tutorial told me to do.</p>
  
  <p>User Model: I put asterisks around the line where the error allegedly is.</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    ****has_secure_password****
  end
  </code></pre>
  
  <p>Sessions Controller:</p>
  
  <pre><code>class SessionsController &lt; ApplicationController
    def new
    end
  
    def create
      user = User.find_by(id: params[session][:id])
      if user &amp;&amp; user.authenticate(params[:session][:password])
        log_in user
        redirect_to root_path
      else
        flash.now[:danger] = 'Invalid'
        render 'new'
      end
    end
  
    def destroy
    end
  end
  </code></pre>
  
  <p>ApplicationController:</p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    protect_from_forgery with: :exception
    include SessionsHelper
  end
  </code></pre>
  
  <p>SessionsHelper:</p>
  
  <pre><code>module SessionsHelper
  
    def log_in(user)
      session[:user_id] = user.id
    end
  end
  </code></pre>
  
  <p>Gemfile:</p>
  
  <pre><code>gem 'bcrypt', '~&gt; 3.1.7'
  </code></pre>
  
  <p>Sessions/new View:</p>
  
  <pre><code>&lt;div id= "admin-sign-in"&gt;
    &lt;%= form_for(:session, url: login_path) do |f| %&gt;
  
      &lt;%= f.label :id %&gt;
      &lt;%= f.text_field :id %&gt;
  
      &lt;%= f.label :password %&gt;
      &lt;%= f.password_field :password %&gt;
  
      &lt;%= f.submit "Log in", class: "btn btn-primary" %&gt;
    &lt;% end %&gt;
  &lt;/div&gt;
  </code></pre>