How to reconfigure rails 4 to use mongodb -


i want configure existing rails application use mongoid instead of sql database. ideally, have used "rails new --skip-active-record name_here." how do after i've made application? haven't done model or database yet there no files created relating database aside made when created rails project.

you can start manually removing references activerecord::base in model files , replace them include mongoid::document

you might need comment every line starting config.active_record in environment configuration files. you'll find these files in /config/environments/

then can use rails g mongoid:config command generate mongoid.yml configuration file.

ps : when using rake you'll have use rake db:mongoid:* commands.

edit:

also remove require rails/all

you'll have require each framework separately, example :

require "action_controller/railtie" require "action_mailer/railtie" require "sprockets/railtie" require "rails/test_unit/railtie" 

the complete list of frameworks included in rails/all here :

  • active_record
  • action_controller
  • action_view
  • action_mailer
  • active_job
  • rails/test_unit
  • sprockets

you can disable migration check in test/test_helper.rb


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -