Frage

Using rails 2.3.5 when I tried to run the command : script/generate scaffold user user_name:string email:string, I get the error:

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

I have searched for this error and I found the only solution is to uncomment this line in my environment.rb

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

which is already uncommented in my environment. What can I do?

War es hilfreich?

Lösung

a newbie's fault :) , i came from rails 3 , and i have installed bundle to be able to install gems in my rails 2 project but i wasn't know that i should comment the line above again in case of using bundler as it wasn't mention in the instruction of adding bundler.

after commenting # config.frameworks -= [ :active_record, :active_resource, :action_mailer ] then i got the following

➜  ~  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

and rake db:migrate is done, so that means now everything is fine ?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top