Skip to content Skip to sidebar Skip to footer

Rails 4 Fails On Sqlite3

I get this error when I run a new empty rails (4.0) site: Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile. I have a valid

Solution 1:

Two bits of news to report. I was passed an explanation for this on the PIK mailing list:

[Luis Lavena] You don't indicate which version of Ruby 2.0 are you using (the exact output of "ruby -v"), but I will assume is x64 bit, correct?

If that is the case, then you're affected by a bug in Bundler. The same was reported here:

Yes, the problem is happening with Ruby v2 64-bit

 w:...> ruby -v
 ruby 2.0.0p195 (2013-05-14) [x64-mingw32]
 
 w:...> bundle -v
 Bundler version 1.3.5

Reading the sparklemotion post the error lies with Bundler. To be fathomed I guess.

On the plus side. I used Rails 4 with Ruby 2 to make the rails project and can run the server to use SQLite3 using JRuby by changing the Gemfile to use the jdbc driver, as shown:

# Use sqlite3 as the database for Active Record
group :development, :testdo#  gem 'sqlite3'
  gem 'activerecord-jdbc-adapter'
  gem 'jdbc-sqlite3'end

It almost looks like Bundler has a thing against SQLite3 doesn't it?

One last thing. The Sqlite3 gem build OK with Ruby v2 and works, as demonstrated with my toy test program. Since it is just a Gem ... the Bundler problem may pop-up for some other gems -- Be alert, probably best to upgrade as soon as you see the problem:

w:...> ruby -S gem update bundler --prerelease
Updating installed gems
Updating bundler
Fetching: bundler-1.4.0.rc.1.gem (100%)
Successfully installed bundler-1.4.0.rc.1
Parsing documentation forbundler-1.4.0.rc.1
Installing ri documentation forbundler-1.4.0.rc.1
Installing darkfish documentation forbundler-1.4.0.rc.1
Done installing documentation forbundler after 9 seconds
Gems updated: bundler

Just check the list

w:...> bundle list
Gems included by the bundle:
    :
  * sprockets (2.10.0)
  * sprockets-rails (2.0.1)
  * sqlite3 (1.3.8)
  * thor (0.18.1)
    :

Works a treat!

:-)

Solution 2:

Dou you have:

gem 'sqlite3'

or something like this

gem 'sqlite3', group: [:development, :test]

in your Gemfile?

Post a Comment for "Rails 4 Fails On Sqlite3"