[英]Random jquery datatables routing issue in Ruby on Rails
因此,我在Ruby on Rails應用程序中使用了數據表,最近我剛剛開始隨機獲取此錯誤消息,但我不確定為什么。
這是消息:
Started GET "/assets/images/sort_asc.png" for 127.0.0.1 at 2014-12-19 23:12:48 -0600
ActionController::RoutingError (No route matches [GET] "/assets/images/sort_asc.png"):
vendor/bundle/ruby/2.1.0actionpack (4.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
vendor/bundle/ruby/2.1.0actionpack (4.1.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
vendor/bundle/ruby/2.1.0railties (4.1.0) lib/rails/rack/logger.rb:38:in `call_app'
vendor/bundle/ruby/2.1.0railties (4.1.0) lib/rails/rack/logger.rb:20:in `block in call'
vendor/bundle/ruby/2.1.0activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
vendor/bundle/ruby/2.1.0activesupport (4.1.0) lib/active_support/tagged_logging.rb:26:in `tagged'
vendor/bundle/ruby/2.1.0activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `tagged'
vendor/bundle/ruby/2.1.0railties (4.1.0) lib/rails/rack/logger.rb:20:in `call'
vendor/bundle/ruby/2.1.0actionpack (4.1.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/runtime.rb:17:in `call'
vendor/bundle/ruby/2.1.0activesupport (4.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/lock.rb:17:in `call'
vendor/bundle/ruby/2.1.0actionpack (4.1.0) lib/action_dispatch/middleware/static.rb:64:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
vendor/bundle/ruby/2.1.0railties (4.1.0) lib/rails/engine.rb:514:in `call'
vendor/bundle/ruby/2.1.0railties (4.1.0) lib/rails/application.rb:144:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/lock.rb:17:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/content_length.rb:14:in `call'
vendor/bundle/ruby/2.1.0rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/user/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/home/user/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/home/user/.rvm/rubies/ruby-2.1.3/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
Rendered vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (0.9ms)
Rendered vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/routes/_route.html.erb (7.4ms)
Rendered vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/routes/_table.html.erb (1.1ms)
Rendered vendor/bundle/ruby/2.1.0/gems/actionpack-4.1.0/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (80.3ms)
這是我的application.js和application.css文件的樣子:
#application.js
/ This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
。
#application.css
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*= require dataTables/jquery.dataTables
*/
知道我為什么要得到這個嗎? 實際的文件在那里(我只是手動放置了它們,但是我不確定這里還缺少什么。
將行放在application.js中的需求樹之前
//= require bootstrap
//= require dataTables/jquery.dataTables
//= require dataTables/bootstrap/3/jquery.dataTables.bootstrap
在CSS清單中,將*= require dataTables/jquery.dataTables
*= require_tree .
之前*= require_tree .
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.