Rails 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:
$ rails app new MyApp --skip-active-record
Gemfile
gem 'mongoid', '~> 5.0'
bundle install
and follow the installation steps from the desired database.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