rake db:create& rails服务器

时间:2012-08-15 07:26:12

标签: ruby-on-rails

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

  

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

我遇到了几个问题:

  1. 我无法运行rake db:create
  2. 我无法运行rake server
  3. Workstation是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$ 
    

1 个答案:

答案 0 :(得分:0)

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

require "active_record/railtie"