MongoDB
 sql >> Database >  >> NoSQL >> MongoDB

Non riesco a far funzionare mongoid con Rails 4

Ho risolto aggiungendo:

Mongoid.load!(Rails.root.join("/config/mongoid.yml"))

a config/intializers/mongoid.rb , come da tutorial.

Inoltre dovrai modificare la seguente riga nel tuo file config/application.rb da:

require 'rails/all'

a (in Rails 3.x):

require "action_controller/railtie"
require "action_mailer/railtie"
require "active_resource/railtie"
require "rails/test_unit/railtie"
# require "sprockets/railtie" # Uncomment this line for Rails 3.1+

o (in Rails 4.x):

# Pick the frameworks you want:
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
require "rails/test_unit/railtie"