Set default database connection Rails
If you don't want to change the config/application.rb you could use this while generating the model:
rails generate active_record:migration
If you change the application.rb file, to invoke a mongoid generator, say for a model 'contacts', one would use:
rails g mongoid:model contacts
(solution link)
Add this to the Application block in config/application.rb
:
config.generators do |g|
g.orm :active_record
end
(found here)