0

我是 RoR 的新手,一直在尝试完成入门链接

http://guides.rubyonrails.org/getting_started.html

我遇到了几个问题:

  1. 我不能跑rake db:create
  2. 我不能跑rake server

工作站是 Ubuntu 12.04、Rails 3.2.8、Ruby 1.9.3p194。

mukeshk@ubuntu:~/NetBeansProjects/rails_work/blog/config$ rake db:create
(in /home/mukeshk/NetBeansProjects/rails_work/blog)
rake aborted!
undefined method `active_record' for #<Rails::Application::Configuration:0x00000002080410>

(See full trace by running task with --trace)

mukeshk@ubuntu:~/NetBeansProjects/rails_work/blog/config$ rails server
/home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x00000002a02f60> (NoMethodError)
    from /home/mukeshk/NetBeansProjects/rails_work/blog/config/application.rb:54:in `<class:Application>'
    from /home/mukeshk/NetBeansProjects/rails_work/blog/config/application.rb:13:in `<module:Blog>'
    from /home/mukeshk/NetBeansProjects/rails_work/blog/config/application.rb:12:in `<top (required)>'
    from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:53:in `require'
    from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
    from /home/mukeshk/.rvm/gems/ruby-1.9.3-p194@rails32/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
mukeshk@ubuntu:~/NetBeansProjects/rails_work/blog/config$ 
4

1 回答 1

0

将此添加到您的 config/application.rb:

require "active_record/railtie"
于 2012-08-15T07:52:53.873 回答