Create a new Rails app with a non-standard database adapter
suggest changeRails is shipped by default with ActiveRecord, an ORM (Object Relational Mapping) derived from the pattern with the same name.
As an ORM, it is built to handle relational-mapping, and more precisely by handling SQL requests for you, hence the limitation to SQL databases only.
However, you can still create a Rails app with another database management system:
- Create the app without Active Record:
$ rails new MyApp --skip-active-record
- Add the database library to the Gemfile:
gem 'mongoid', '~> 5.0'
- Run
bundle installand follow that library’s install steps.
In this example, mongoid is an object mapping for MongoDB and - as many other database gems built for rails - it also inherits from ActiveModel the same way as ActiveRecord, which provides a common interface for many features such as validations, callbacks, translations, etc.
Other database adapters include, but are not limited to :
- datamapper
- sequel-rails
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents