首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在尝试安装rspec时发出活动支持--未定义的方法'to_sym‘用于nil:NilClass

在尝试安装rspec时发出活动支持--未定义的方法'to_sym‘用于nil:NilClass
EN

Stack Overflow用户
提问于 2013-06-06 01:05:54
回答 1查看 650关注 0票数 1

我正在尝试安装RSpec,以便在我没有编写的应用程序上进行一些测试。我已经把

gem "rspec-rails","~> 2.8“

在我的ran文件中运行了bundle安装。这个效果很好。直到我跑了

rails生成rspec:install

我知道这个错误:

/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/whiny_nil.rb:48:in method_missing': undefined methodto_sym‘for nil:NilClass (NoMethodError)来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1309:in action_path' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1304:in path_for_action’从/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1159:in match' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1358:in match‘get /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:394:in map_method' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:323:in’get‘from /User/anthonyto/ActiveNetwork/active-培训器/config/routeres.rb:447:在控制器中的block (4 levels) in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in块中,“从/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:446:in scope' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:565:in控制器”到“名称空间中的/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:446:in block (3 levels) in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in块”,来自/Users/anthonyto/。rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in scope' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in命名空间‘来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1119:in namespace' from /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:406:in块(2个级别)’from /Users/anthonyto/..rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in block in namespace' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:546:in作用域“从/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:624:in namespace' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/mapper.rb:1119:in命名空间”到/Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:405:in从/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:in draw' from /Users/anthonyto/ActiveNetwork/active-trainer/config/routes.rb:1:in到/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in load' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in块的block in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/actionpack-3.0.20/lib/action_dispatch/routing/route_set.rb:239:in instance_exec‘load来自/Users/anthonyto的“从/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in block in load_dependency' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in new_constants_in”到/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in load_dependency' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:236:in load‘/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in block in reload_routes!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in各‘来自routes_reloader中的/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:127:in reload_routes!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:120:in块’来自/Users/anthonyto/..rvm/gems/ruby-1.9。3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:in call' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/file_update_checker.rb:32:in execute_if_updated“/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:51:in block (2 levels) in <module:Finisher>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:in call”来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application/finisher.rb:52:in block in <module:Finisher>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:25:in instance_exec从run_initializers中的/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:25:in run' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:50:in块到/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:49:in each' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/initializable.rb:49:in run_initializers‘from initialize!' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:77:in method_missing’from /Users/anthonyto/ActiveNetwork/active-trainer/config/environment.rb:5:in <top (required)>' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in require‘from /Users/anthonyto/..rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in block in require' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in block in load_dependency‘from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:597:in new_constants_in' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:225:in load_dependency’from /Users/anthonyto/..rvm/gems/ruby-1.9.3-p 194/gems/activesupport-3.0.20/lib/active_support/dependencies.rb:242:in require' from /Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/application.rb:103:in require_environment!来自/Users/anthonyto/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.0.20/lib/rails/commands.rb:16:in <top (required)>' from script/rails:7:inrequire‘from script/rails:7:in

我运行的是ruby版本1.9.3和rails版本3.0.20。我可以提供任何额外的信息,任何帮助都将非常感谢。谢谢大家!

编辑:当我试图启动我的rails服务器时,我得到了同样的错误。我的应用程序似乎有一个更深层次的问题。我以前当然没有这个问题,我想不出我做了什么事情会导致这个问题。

EN

回答 1

Stack Overflow用户

发布于 2013-06-10 23:26:17

修正:所以我搞清楚了到底是怎么回事,我会把它留给其他遇到这个恼人错误的人。原来我是个白痴,在routes.rb文件中留下了一些错误代码,如下所示:

控制器:日历要写#写一些路线在这里结束

评论一下,一切都很顺利。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16952195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档