2
votes

First, I'm bad at english, so I can't give a lot of details.. I've been trying to create a website using ruby on rails:

rails new azer
rails generate controller pages home

The last command doesn't work and there's an error occuring during generating:

/home/esteban/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/connection_specification.rb:177: in 'rescue in spec': Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).(Gem::LoadError)

So I opened my gemfile:

source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.10'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
...
...

I'm unsure what might be the error cause thus I don't know how to proceed.

Versions:

Ruby     2.4.4
Rails    4.2.10
SQLite3  1.4.1.

EDIT : Thanks for your help everyone, I appreciate it ! I just tried to reinstall rails and it worked

1
Did you run bundle install after rails new azer?CAmador
Papy, the sentences like "I'm bad at english" are purposively edited out of the question. They don't help readers in any way and if editor find issue with the question, he will help and edit it for you.Tatranskymedved
@CAmador yes, and it sadly doesn't solve the problemPapy Poule
@Tatranskymedved Oh, sorry then. I just didn't want to get blamed for the lack of detailsPapy Poule
Is gem sqlite3 actually installed? Run gem list sqlite to confirm. Is SQLite3 installed in your system?CAmador

1 Answers

1
votes

It seems version 1.4.x won't work with Rails 4. Install version 1.3.13 instead:

Unisntall version 1.4.1:

gem uninstall sqlite3 -v1.4.1

Modify Gemfile:

gem 'sqlite3', '~> 1.3.13'

And run bundle install.