I'm new to Ruby on Rails.I've been trying generate mongoid.yml file to connect with mongodb. but im getting this error:
`Could not find generator 'mongoid:config'.
Did you mean? mongoid:devise
Run `bin/rails generate --help` for more options.`
This is my Gemfile
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby "3.1.3"
gem 'mongoid'
gem 'jquery-rails'
gem 'devise'
gem 'figaro'
gem 'haml-rails'
gem 'haml'
gem "bson"
gem "moped", github: "mongoid/moped"`
gem 'nokogiri'
gem 'kaminari'
gem 'rack-contrib'
gem 'soulmate', require: 'soulmate/server'
gem 'carrierwave'
gem 'carrierwave-mongoid', require: 'carrierwave/mongoid'
gem 'colorize'
gem 'typhoeus'
gem 'execjs'
gem 'roo'
gem 'addressable', require: 'addressable/uri'
gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem "passenger",require: "phusion_passenger/rack_handler"
I tried adding these to Gemfile. But not working.
gem 'activemodel-serializers-xml', github: 'rails/activemodel-serializers-xml' gem "active_model_serializers", require: true gem 'activemodel-serializers-xml' gem 'active_model_serializers'
I have noticed gem moped is kind of old for this version of mongoid. Please help if anyone
Thank you in advance!
moped
is an out of date (legacy) version of the MongoDB Ruby Driver.
When you add the mongoid
gem to your Gemfile
, it will automatically pull in the version of the driver (mongo
) that matches the dependency in the gemspec (ex: https://github.com/mongodb/mongoid/blob/v8.0.3/mongoid.gemspec#L41).
Removing moped
from your Gemfile
and re-running bundle install
should do the trick ;)