在Rails中生成控制器会引发一种类型

时间:2017-01-07 01:15:01

标签: ruby-on-rails ruby

这是错误:

$ rails generate controller orders
/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之外,我没有做任何事情。我不确定为什么会这样做,并会感谢任何帮助。我之前已经问过这个问题,我刚刚解决了sass gem错误,这似乎不是我问题的答案。

编辑: 这是config/routes.rb

$ cat config/routes.rb 
Frothyfox::Application.routes.draw do
  # The priority is based upon order of creation:
  # first created -> highest priority.

  # Sample of regular route:
  #   match 'products/:id' => 'catalog#view'
  # Keep in mind you can assign values other than :controller and :action

  # Sample of named route:
  #   match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products

  # Sample resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end

  # Sample resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end

  # Sample resource route with more complex sub-resources
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', :on => :collection
  #     end
  #   end

  # Sample resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end

  # You can have the root of your site routed with "root"
  # just remember to delete public/index.html.
  # root :to => 'welcome#index'

  # See how all your routes lay out with "rake routes"

  # This is a legacy wild controller route that's not recommended for RESTful applications.
  # Note: This route will make all actions in every controller accessible via GET requests.
  # match ':controller(/:action(/:id))(.:format)'
end

0 个答案:

没有答案