1

当我尝试运行命令时使用 rails 2.3.5 时script/generate scaffold user user_name:string email:string,我得到了错误:

uninitialized constant Rails::Generator::GeneratedAttribute::ActiveRecord

我已经搜索了这个错误,我发现唯一的解决方案是在我的environment.rb

config.frameworks -= [ :active_record, :active_resource, :action_mailer ]

这在我的环境中已经没有注释了。我能做些什么?

4

1 回答 1

0

新手的错 :),我来自 rails 3,并且我已经安装了 bundle 以便能够在我的 rails 2 项目中安装 gem,但我不知道如果使用 bundler,我应该再次评论上面的行'在添加捆绑器的说明中没有提及。

发表评论# config.frameworks -= [ :active_record, :active_resource, :action_mailer ] 后,我得到以下信息

➜  ~  script/generate scaffold user user_name:string email:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      exists  app/views/users
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      exists  test/unit/helpers/
      exists  public/stylesheets/
overwrite app/views/users/index.html.erb? (enter "h" for help) [Ynaqdh] y
       force  app/views/users/index.html.erb
      create  app/views/users/show.html.erb
      create  app/views/users/new.html.erb
      create  app/views/users/edit.html.erb
      create  app/views/layouts/users.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/users_controller.rb
      create  test/functional/users_controller_test.rb
      create  app/helpers/users_helper.rb
      create  test/unit/helpers/users_helper_test.rb
       route  map.resources :users
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/user.rb
      create    test/unit/user_test.rb
      create    test/fixtures/users.yml
      create    db/migrate
      create    db/migrate/20130820214343_create_users.rb

并且rake db:migrate完成了,这意味着现在一切都很好?

于 2013-08-20T21:49:48.580 回答