簡體   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