0

我正在按照本教程使用 ember-rails gem 创建一个 ember-rails 应用程序。

我在教程的最后,但我收到了一个路由错误

在浏览器中:

 uninitialized constant EmberController

在终端中:

   ActionController::RoutingError (uninitialized constant EmberController):
   activesupport (3.2.12) lib/active_support/inflector/methods.rb:230:in `block in constantize'
   activesupport (3.2.12) lib/active_support/inflector/methods.rb:229:in `each'
   activesupport (3.2.12) lib/active_support/inflector/methods.rb:229:in `constantize'
   actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:69:in `controller_reference'
   actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:54:in `controller'
   actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:32:in `call'
   journey (1.0.4) lib/journey/router.rb:68:in `block in call'
   journey (1.0.4) lib/journey/router.rb:56:in `each'
   journey (1.0.4) lib/journey/router.rb:56:in `call'
   actionpack (3.2.12) lib/action_dispatch/routing/route_set.rb:601:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
   rack (1.4.5) lib/rack/etag.rb:23:in `call'
   rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/head.rb:14:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/flash.rb:242:in `call'
   rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
   rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/cookies.rb:341:in `call'
   activerecord (3.2.12) lib/active_record/query_cache.rb:64:in `call'
   activerecord (3.2.12)           lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
   activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `_run__4018265295575118160__call__2187012938703494479__callbacks'
   activesupport (3.2.12) lib/active_support/callbacks.rb:405:in `__run_callback'
   activesupport (3.2.12) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
   activesupport (3.2.12) lib/active_support/callbacks.rb:81:in `run_callbacks'
   actionpack (3.2.12) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/reloader.rb:65:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
   railties (3.2.12) lib/rails/rack/logger.rb:32:in `call_app'
   railties (3.2.12) lib/rails/rack/logger.rb:16:in `block in call'
   activesupport (3.2.12) lib/active_support/tagged_logging.rb:22:in `tagged'
   railties (3.2.12) lib/rails/rack/logger.rb:16:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/request_id.rb:22:in `call'
   rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
   rack (1.4.5) lib/rack/runtime.rb:17:in `call'
   activesupport (3.2.12) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
   rack (1.4.5) lib/rack/lock.rb:15:in `call'
   actionpack (3.2.12) lib/action_dispatch/middleware/static.rb:62:in `call'
   railties (3.2.12) lib/rails/engine.rb:479:in `call'
   railties (3.2.12) lib/rails/application.rb:223:in `call'
   rack (1.4.5) lib/rack/content_length.rb:14:in `call'
   railties (3.2.12) lib/rails/rack/log_tailer.rb:17:in `call'
   rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'
   /Users/user/.rvm/rubies/ruby-1.9.3-p385/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'

路线.rb

Application::Application.routes.draw do
   namespace :api do
     namespace :v1 do
       resources :posts
     end
   end

   root :to => 'ember#start'
 end

但是 EmberController 不存在。事实上,我搜索了整个文件夹,并且该名称存在的唯一位置是在日志文件中。我在这里想念什么?

rake 路由的输出

    api_v1_posts GET    /api/v1/posts(.:format)          api/v1/posts#index
                 POST   /api/v1/posts(.:format)          api/v1/posts#create
 new_api_v1_post GET    /api/v1/posts/new(.:format)      api/v1/posts#new
edit_api_v1_post GET    /api/v1/posts/:id/edit(.:format) api/v1/posts#edit
     api_v1_post GET    /api/v1/posts/:id(.:format)      api/v1/posts#show
                 PUT    /api/v1/posts/:id(.:format)      api/v1/posts#update
                 DELETE /api/v1/posts/:id(.:format)      api/v1/posts#destroy
            root        /                                ember#start
4

0 回答 0