我觉得我太纯粹了

Posted by Wenqing Gu (guwenqing)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
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
This entry was posted in 未分类. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>