1

在使用带有 ruby​​ 1.8.6 的 rails 2.0.2 使用旧应用程序时,遇到以下问题......

当我尝试执行任何 rake(v 0.8.3) 命令时 { 例如。耙路线}。

rake aborted!
Don't know how to build task 'routes'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1706:in `[]'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2018:in `invoke_task'
 ~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `each'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1970:in `run'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_excetion_handling'
~/.rvm/gems/ruby-1.8.6-p420@rails202/gems/rake-0.8.3/lib/rake.rb:1967:in `run'
~/.rvm/gems/ruby-1.8.6-p420@rails202/bin/rake:31

最初没有 rakefile,我添加了一个,内容如下

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

XXX::Application.load_tasks
4

1 回答 1

3

我有一个 rails 2.3.8 应用程序

Rakefile 看起来像这样:

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require 'thread'
require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

您添加的 rake 文件与 rails 3 兼容,我认为它不适用于早期版本。

编辑:您必须已经设置了 rails 2.0.2,我建议创建一个新的 rails 2.0.2 应用程序并确定缺少的链接。

于 2012-08-10T11:36:40.600 回答