ruby-on-rails – 什么是路由错误和rake路由错误?

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 什么是路由错误和rake路由错误?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是Ruby on Rails的新手.
在摆弄了一个星期之后我决定放弃它,买了一本书.全部重新安装.现在,当我以为我修复它时,我收到一个错误说:
Routing Error

No route matches "/index"

所以我做了

rake routes

这导致了下面的错误列表.

/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:4:
warning: already initialized constant MAJOR
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:5:
warning: already initialized constant MINOR
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:6:
warning: already initialized constant BUILD
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:3:
warning: already initialized constant NUMBERS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/version.rb:9:
warning: already initialized constant VERSION
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:26:
warning: already initialized constant RAKEVERSION
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/early_time.rb:17:
warning: already initialized constant EARLY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/alt_system.rb:32:
warning: already initialized constant WINDOWS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/application.rb:28:
warning: already initialized constant DEFAULT_RAKEFILES WARNING:
Possible conflict with Rake extension: String#ext already exists
WARNING: Possible conflict with Rake extension: String#pathmap already
exists
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/task_arguments.rb:73:
warning: already initialized constant EMPTY_TASK_ARGS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49:
warning: already initialized constant EMPTY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:10:
warning: already initialized constant RUBY
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_utils.rb:84:
warning: already initialized constant LN_SUPPORTED
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143:
warning: already initialized constant Commands
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:44:
warning: already initialized constant ARRAY_METHODS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:47:
warning: already initialized constant MUST_DEFINE
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:51:
warning: already initialized constant MUST_NOT_DEFINE
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:55:
warning: already initialized constant SPECIAL_RETURN
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:61:
warning: already initialized constant DELEGATING_METHODS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:364:
warning: already initialized constant DEFAULT_IGNORE_PATTERNS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake/file_list.rb:370:
warning: already initialized constant DEFAULT_IGNORE_PROCS
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:64:
warning: already initialized constant FileList
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290@global/gems/rake-0.9.2/lib/rake.rb:65:
warning: already initialized constant RakeFileUtils rake aborted!
stack level too deep
/Users/dennisbuizert/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/rake_module.rb:25

解决方法

尝试安装旧版本的rake.

gem install rake -v = 0.8.7

使用rake时可能会收到警告消息.

警告:不建议全局访问Rake DSL方法.请包括
… Rake :: DSL成为使用Rake DSL方法的类和模块.

调用应用程序load_tasks之前,您可以在Rakefile中添加“include Rake :: DSL”.

我找到了一个帖子来解决这个问题.
Global access to Rake DSL methods is deprecated

原文链接:https://www.f2er.com/ruby/274155.html

猜你在找的Ruby相关文章