2013-08-20 59 views
0

使用Rails 2.3.5當我試圖運行命令:script/generate scaffold user user_name:string email:string,我得到的錯誤:未初始化的常量的Rails ::發電機:: GeneratedAttribute :: ActiveRecord的

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

...我已經尋找這個錯誤,我發現的唯一的解決辦法是去掉這一行我environment.rb

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

這是在我的環境已經註釋。我能做什麼?

+0

這是一個很難的問題,它可能是2.3.5 rails的問題,也可能是因爲你沒有使用bundle exec,但那不太可能。我不得不說,要解決這個問題,我需要看到你回溯到告訴你更多。考慮到這些版本中已經解決了2.3.5中的一些安全漏洞,我首先會嘗試更新到2.3.18。 – Brandt

+0

一個新手的錯:),我來自rails 3,並且我已經安裝了bundle以便能夠在我的rails 2項目中安裝gems,但是我不知道我應該在使用bundler的情況下再次評論上一行在添加捆綁器的指令中沒有提及。 –

+0

請看我的回答,告訴我這是否正確 –

回答

0

一個新手的錯:),我來自rails 3,我已經安裝了bundle,能夠在我的rails 2項目中安裝gems,但我不知道我應該在使用情況下再次註釋上面的行因爲在添加打包程序的指令中沒有提及。

評論# 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做,所以現在意味着一切都很好?

相關問題