在rails中生成控制器会引发TypeError

时间:2017-01-05 16:41:33

标签: ruby-on-rails ruby

这是错误:

$ rails generate controller orders
DEPRECATION WARNING:
Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

/home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `merge': can't convert String into Hash (TypeError)
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:254:in `root'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1321:in `root'
        from /home2/shsprogr/rails/frothyfox/config/routes.rb:2:in `block in <top (required)>'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `instance_exec'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:289:in `eval_block'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:267:in `draw'
        from /home2/shsprogr/rails/frothyfox/config/routes.rb:1:in `<top (required)>'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `each'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:40:in `load_paths'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:16:in `reload!'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:26:in `block in updater'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `call'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/activesupport-3.2.13/lib/active_support/file_update_checker.rb:78:in `execute'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:27:in `updater'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
        from /home2/shsprogr/rails/frothyfox/config/environment.rb:5:in `<top (required)>'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application.rb:103:in `require'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
        from /home2/shsprogr/rails/frothyfox/vendor/cache/ruby/1.9.3/gems/railties-3.2.13/lib/rails/commands.rb:25:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

我使用Rails 3.2.13和Ruby 1.9.3并且除了rails new frothyfoxbundle install之外我还没有做任何事情。我不确定它为什么要这样做,并希望得到任何帮助。

1 个答案:

答案 0 :(得分:1)

Sass 3.5 will no longer support Ruby 1.9.3.
Please upgrade to Ruby 2.0.0 or greater as soon as possible.

此错误告诉您确切需要执行的操作。你使用Ruby 1.9.3;你也在使用SASS 3.5,它不再支持那个版本的ruby。只需将您的Ruby版本更新为最新版本。

如果您需要帮助,请查看以下步骤How to update Ruby Version 2.0.0 to the latest version in Mac OSX Yosemite?