title: UPDATED: Sqlite3 gem rails not working on heroku and local env
body: <p>I am using heroku in a rails blog. After being able to fix the gem file following many related answers here, and being able to push my blog to heroku the app is not working locally. </p>
  
  <p>I have change 'sqlite3' for 'pg' in my production env and add 'sqilte3' only in development test, push my changes to git and after to heroku. So far it was working but when I try to run the rails server, is asking me for 'sqlite3' again.</p>
  
  <p>Error: </p>
  
  <blockquote>
    <p>rb:177:in <code>rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add</code>gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)</p>
  </blockquote>
  
  <pre><code>GEMFILE 
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>source 'https://rubygems.org'
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '4.2.4'
  # Use SCSS for stylesheets
  gem 'sass-rails', '~&gt; 5.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.1.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  # gem 'therubyracer', platforms: :ruby
  # Use jquery as the JavaScript library
  gem 'jquery-rails'
  # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
  gem 'turbolinks'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.0'
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '~&gt; 0.4.0', group: :doc
  
  gem 'devise'
  
  gem 'will_paginate', '~&gt; 3.0.5'
  
  gem 'cancancan'
  
  gem "paperclip", "~&gt; 5.0.0.beta1"
  
  gem 'ratyrate'
  
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use Unicorn as the app server
  # gem 'unicorn'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug'
  
    gem "sqlite3"
  
    gem 'rspec-rails', '~&gt; 3.0'
  end
  
  group :development do
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; in views
    gem 'web-console', '~&gt; 2.0'
  
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
    gem 'spring'
  end
  
  group :production do
    gem 'rails_12factor'
    gem 'pg'
  end</code></pre>
  </div>
  </div>
  </p>
  
  <pre><code>DATABASE.YML
  </code></pre>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code># SQLite version 3.x
  #   gem install sqlite3
  #
  #   Ensure the SQLite 3 gem is defined in your Gemfile
  #   gem 'sqlite3'
  #
  default: &amp;default
    adapter: sqlite3
    pool: 5
    timeout: 5000
  
  development:
    &lt;&lt;: *default
    database: db/development.sqlite3
  
  # Warning: The database defined as "test" will be erased and
  # re-generated from your development database when you run "rake".
  # Do not set this db to the same as development or production.
  test:
    &lt;&lt;: *default
    database: db/test.sqlite3
  
  production:
    &lt;&lt;: *default
    database: db/production.sqlite3</code></pre>
  </div>
  </div>
  
  I have followed the steps here >> <a href="http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast" rel="nofollow">http://railscasts.com/episodes/342-migrating-to-postgresql?view=asciicast</a> >> and is working now. Note for beginners, if you are going to use rails and heroku start you application with pg to save time debugging this. </p>