简体   繁体   中英

`method_missing': undefined method `active_record' for #<Rails::Application::Configuration - Rails with MongoDB

Am using mongoDB and I create rails new app.

rails new app_name --skip-active-record

I used

gem 'mongoid', '~> 5.0.0.beta', github: 'mongoid/mongoid'
gem 'bson_ext'
gem 'devise'

When i am trying rails g devise:install , it raise an error

method_missing': undefined method active_record' for # (NoMethodError)

And config/application.rb

require "rails"
require "active_model/railtie"
require "active_job/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"

Need Help.

When you create your app, you skip active_record - then later on you get an error that it can't find active_record.

Have you tried creating the app without the --skip-active-record flag?

Edit:

Looks like you were right to skip active record , but you forgot to run rails g mongoid:config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM