script/generate and MongoMapper

15 views
Skip to first unread message

John Nunemaker

unread,
Nov 18, 2009, 4:43:21 PM11/18/09
to mongo...@googlegroups.com
Posting from email sent to me so all can see answer.

Dear John,

I have installed MongoMapper according to the directions given in "Getting
Started With MongoMapper and Rails". When I run the command:

script/generate model contact --skip-migration

I get the error:

uninitialized constant ModelGenerator::ActiveRecord

I have the following config/environment.rb file:

RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION

require File.join(File.dirname(__FILE__), 'boot')

Rails::Initializer.run do |config|
config.gem 'mongo_mapper'
config.frameworks -= [:active_record]
end

and the following config/initializers/database.rb file:

include MongoMapper

MongoMapper.database = "addressbook-#{Rails.env}"

# Handle passenger forking.
if defined?(PhusionPassenger)
PhusionPassenger.on_event(:starting_worker_process) do |forked|
MongoMapper.database.connect_to_master if forked
end
end

I also removed the config/database.yml file.

Do you have any suggestions on what I'm doing wrong?

jnunemaker

unread,
Nov 18, 2009, 4:44:47 PM11/18/09
to MongoMapper
The model generators don't work if you remove active record framework.
You have to add the framework back in or just not use the generators
for now.

Aron Pilhofer

unread,
Nov 22, 2009, 10:53:34 AM11/22/09
to MongoMapper
You can try this gem as an alternative. http://github.com/stympy/mongo-generators

On Nov 18, 4:43 pm, John Nunemaker <nunema...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages