当我尝试运行命令时使用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 ]
在我的环境中已经取消注释。我该怎么办?
答案 0 :(得分:0)
一个新手的故障:),我来自rails 3,我已经安装了bundle以便能够在我的rails 2项目中安装宝石但是我不知道我应该在使用bundler的情况下再次评论上面的行因为在添加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
完成了,这意味着一切都很好吗?