繁体   English   中英

错误:控制器已添加到轨道上的URL ruby

[英]error: Controller is added to url ruby on rails

一切正常,但是当我转到新建页面或编辑页面时,布局上的链接在它们之前获得了控制器的名称,这使得图像和链接不起作用。

例子:

/image/logo.jpg | 在孩子里面/新的时候| 变成:kids / image / logo.jpg

home.hmtl变成kidss / home.html

 rake routes
       Prefix Verb   URI Pattern                 Controller#Action
         kids GET    /kids(.:format)             kids#index
              POST   /kids(.:format)             kids#create
      new_kid GET    /kids/new(.:format)         kids#new
     edit_kid GET    /kids/:id/edit(.:format)    kids#edit
          kid GET    /kids/:id(.:format)         kids#show
              PATCH  /kids/:id(.:format)         kids#update
              PUT    /kids/:id(.:format)         kids#update
              DELETE /kids/:id(.:format)         kids#destroy
sponsor_index GET    /sponsor(.:format)          sponsor#index
              POST   /sponsor(.:format)          sponsor#create
  new_sponsor GET    /sponsor/new(.:format)      sponsor#new
 edit_sponsor GET    /sponsor/:id/edit(.:format) sponsor#edit
      sponsor GET    /sponsor/:id(.:format)      sponsor#show
              PATCH  /sponsor/:id(.:format)      sponsor#update
              PUT    /sponsor/:id(.:format)      sponsor#update
              DELETE /sponsor/:id(.:format)      sponsor#destroy

关于如何解决这个问题的任何想法? 我是红宝石的新手,在任何地方都找不到答案。

这是运行服务器时得到的:

Started GET "/kids/new" for ::1 at 2015-12-09 17:21:57 -0700
  ActiveRecord::SchemaMigration Load (0.0ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by KidsController#new as HTML
  Rendered kids/_form.html.erb (36.0ms)
  Rendered kids/new.html.erb within layouts/internas (65.0ms)
Completed 200 OK in 426ms (Views: 402.0ms | ActiveRecord: 0.0ms)


Started GET "/kids/img/logoverde.png" for ::1 at 2015-12-09 17:21:58 -0700

ActionController::RoutingError (No route matches [GET] "/kids/img/logoverde.png"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (4.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1349.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (1024.7ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2317.6ms)


Started GET "/assets/application.self-105c700c87c919bec5418f6c6f8dc61317ea50918c4bc25a71d70bb3172ba0c8.css?body=1" for
::1 at 2015-12-09 17:22:03 -0700


Started GET "/kids/js/scripts.js" for ::1 at 2015-12-09 17:22:03 -0700

ActionController::RoutingError (No route matches [GET] "/kids/js/scripts.js"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1474.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (897.2ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2102.0ms)


Started GET "/kids/js/parallax.js" for ::1 at 2015-12-09 17:22:07 -0700

ActionController::RoutingError (No route matches [GET] "/kids/js/parallax.js"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1405.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (906.6ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2111.5ms)


Started GET "/images/default_profile.png" for ::1 at 2015-12-09 17:22:11 -0700

ActionController::RoutingError (No route matches [GET] "/images/default_profile.png"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1451.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (908.6ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2073.5ms)


Started GET "/kids/img/logobranco.png" for ::1 at 2015-12-09 17:22:15 -0700

ActionController::RoutingError (No route matches [GET] "/kids/img/logobranco.png"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1386.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (938.7ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2289.6ms)


Started GET "/kids/img/logoverde.png" for ::1 at 2015-12-09 17:22:20 -0700

ActionController::RoutingError (No route matches [GET] "/kids/img/logoverde.png"):
  actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  web-console (2.2.1) lib/web_console/middleware.rb:39:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.5) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call'
  rack (1.6.4) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.5) lib/rails/engine.rb:518:in `call'
  railties (4.2.5) lib/rails/application.rb:165:in `call'
  rack (1.6.4) lib/rack/lock.rb:17:in `call'
  rack (1.6.4) lib/rack/content_length.rb:15:in `call'
  rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
  c:/Ruby22/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
  c:/Ruby22/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'


  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_trace.
html.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_route.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/routes/_table.h
tml.erb (2.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/_reques
t_and_response.html.erb (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/actionpack-4.2.5/lib/action_dispatch/middleware/templates/rescues/routing
_error.html.erb within rescues/layout (1359.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_markup.html.erb (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_inner_console_markup.html.er
b within layouts/inlined_string (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/_prompt_box_markup.html.erb w
ithin layouts/inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/style.css.erb within layouts/
inlined_string (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/console.js.erb within layouts
/javascript (974.7ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/main.js.erb within layouts/ja
vascript (0.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/error_page.js.erb within layo
uts/javascript (1.0ms)
  Rendered c:/Ruby22/lib/ruby/gems/2.2.0/gems/web-console-2.2.1/lib/web_console/templates/index.html.erb (2223.6ms)

当它说:

Started GET "/kids/img/logoverde.png" for ::1

我应该是/img/logoverde.png,没有控制器“ kids”的名称,并且图像位于布局内,而不位于视图内。

图像在导航div内

<nav>

                    <div class="nav-bar text-center">
                        <div class="col-md-2 col-md-push-5 col-sm-12 text-center">
                            <a href="index.html" target="_self">
                                <img alt="logo" class="image-xxs" src="img/logoverde.png">
                            </a>
                        </div>

您在代码中使用相对路径。 您的浏览器并不总是在domain.com/img/logoverde.png搜索该图像。 然后,您转到domain.com/kids/1 ,浏览器尝试从domain.com/kids/img/logoverde.png加载图像。

您必须使用绝对路径(只需在URI路径之前添加斜杠):

<img alt="logo" class="image-xxs" src="/img/logoverde.png">

在Rails中存在一个更好的方法-将图像上传到app/assets/images目录,并使用Assets Pipeline将图像添加到页面。 例如(如果您将logo.png保存在app/assets/images/ ):

<%= image_tag "logo.png" %>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM