Ruby Forum Ruby on Rails > generate model error

Posted by Wenqing Gu (guwenqign)
on 25.09.2009 10:18
I'm new on rails, and I encountered a problem when I am doing a
tutorial: that's a simple application without a database.

First "rails simple_app"
And modify "enviroment.rb"

  # Skip frameworks you're not going to use. To use Rails without a
database,
  # you must remove the Active Record framework.
  config.frameworks -= [ :active_record, :active_resource,
:action_mailer ]

However, after that when I execute the command "ruby script/generate
model Item" there will be an error raised:
uninitialized constant ModelGenerator::ActiveRecord

Anyone knows the origin of the problem, and how to solve it

BTW: I am using rails 2.3.4 and ruby 1.8.7
Posted by Colin Law (Guest)
on 25.09.2009 10:41
(Received via mailing list)
2009/9/25 Wenqing Gu <rails-mailing-list@andreas-s.net>:
>  config.frameworks -= [ :active_record, :active_resource,
> :action_mailer ]
>
> However, after that when I execute the command "ruby script/generate
> model Item" there will be an error raised:
> uninitialized constant ModelGenerator::ActiveRecord
>
> Anyone knows the origin of the problem, and how to solve it

I may be wrong ( I often am ) but I would guess that the Model
generator assumes that you are using ActiveRecord.  It does generate
migrations after all.

Unless you really want to use Rails without a db then I would give it
one.  You do not have to do anything with it in your first forays,
just make it available to keep Rails happy.

Colin