使用带有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
答案 0 :(得分:3)
我有一个rails 2.3.8 app
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应用程序并识别缺失的链接。