B Seven
B Seven

Reputation: 45941

How to use Rails with Mongoid and not PostgreSQL or SQLite?

Added Mongoid but got:

LoadError:
Error loading the 'sqlite3' Active Record adapter.

Removed database.yml and got:

Could not load database configuration. No such file - ["config/database.yml"]

Saved empty database.yml and got:

ActiveRecord::AdapterNotSpecified:
'test' database is not configured. Available: []

Rails 5.2.2

Upvotes: 0

Views: 372

Answers (2)

ashusvirus
ashusvirus

Reputation: 412

If it is fresh install use

rails new app --skip-active-record

if you already created an App with rails, which has active-record(mysql or sqlite3) use this link:

Rails with Mongoid

Also remove

active records

lines from

application.rb

Upvotes: 1

mrzasa
mrzasa

Reputation: 23347

ActiveRecord is a library that works only with relational databases. If you want to use MongoDB with mongoid, you don't need ActiveRecord. Remove any mention of AR and relational DBs from the application code, config and Gemfile. If you're stating from scratch, use rails new myapp --skip-active-record

See also: https://gorails.com/guides/setting-up-rails-4-with-mongodb-and-mongoid (related to Rails 4, but should help).

Upvotes: 0

Related Questions