Pablo Palacios
Pablo Palacios

Reputation: 2957

How to Remove SQLite3 from Rails but keep using ActiveRecord/Mongo?

I have made a Rails project that will use Mongo, I already installed MongoDb and its using it. But the project is requiring to use SQLite3. I can’t find any recommendations on how to remove it without removing ActiveRecord or making a new project .

How should I remove SQLit3 without removing ActiveRecord in order to keep using Mongo?


update This have been very difficult. The app is still crashing and complaining about the ActiveRecord dependencies. I found that is easier to make a clean install if RoR without database

Rails new MyApp -O

Then install Mongo, and it works fine.

gem 'mongoid'
rails g mongoid:config

Also to the same to build an Rspec based app, its better to make the app without the Test section and the add Rspec. So the solution was to go on a clean install

rails new MyApp -O -T

then instal rspec...

My problem is that I already have an app and can’t find an easy way to clean it from SQLite3, so I guess it’s better to migrate the code to a new clean app??

Upvotes: 1

Views: 3457

Answers (1)

aBadAssCowboy
aBadAssCowboy

Reputation: 2520

Your Gemfile will have the line

gem 'sqlite3'

Remove it and run bundle install.

Also, change the configuration in your config/database.yml, it might still be using SQLite3. If there is the below line in database.yml, it means it is trying to use SQLite3:

adapter: splite3

Change it to match the MongoDB configuration.

This will remove SQLite3 requirement for your rails app. However, you need to know that this won't delete the database that was already create in SQLite3 by the rails app, you will have to delete that manually.

Upvotes: 3

Related Questions