1

在我的 Rails 应用程序中,我使用的是 mobile-fu 和 jquery mobile ui。当我通过桌面浏览器测试移动 UI 时,一切正常。当我通过移动浏览器测试我的应用程序时,我看到 development.log 及其显示中所有资产的路由错误。在移动浏览器中一切正常。

Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-06-12 15:02:00 +0530
Served asset /jquery.js - 304 Not Modified (0ms)


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2012-06-12 15:02:00 +0530

ActionController::RoutingError (No route matches [GET] "/jquery.js"):
  actionpack (3.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.2) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.2) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.2) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.2) lib/action_dispatch/middleware/static.rb:61:in `call'
  railties (3.2.2) lib/rails/engine.rb:479:in `call'
  railties (3.2.2) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.2) lib/rails/rack/log_tailer.rb:14:in `call'
  thin (1.3.1) lib/thin/connection.rb:80:in `block in pre_process'
  thin (1.3.1) lib/thin/connection.rb:78:in `catch'
  thin (1.3.1) lib/thin/connection.rb:78:in `pre_process'
  thin (1.3.1) lib/thin/connection.rb:53:in `process'
  thin (1.3.1) lib/thin/connection.rb:38:in `receive_data'
  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
  eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
  thin (1.3.1) lib/thin/backends/base.rb:61:in `start'
  thin (1.3.1) lib/thin/server.rb:159:in `start'
  rack (1.4.1) lib/rack/handler/thin.rb:13:in `run'
  rack (1.4.1) lib/rack/server.rb:265:in `start'
  railties (3.2.2) lib/rails/commands/server.rb:70:in `start'
  railties (3.2.2) lib/rails/commands.rb:55:in `block in <top (required)>'
  railties (3.2.2) lib/rails/commands.rb:50:in `tap'
  railties (3.2.2) lib/rails/commands.rb:50:in `<top (required)>'
  script/rails:6:in `require'
  script/rails:6:in `<main>'


  Rendered /usr/local/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)

这是我正在使用的代码

application_controller.rb

  has_mobile_fu
  ...

移动.js

//= require jquery
//= require jquery_ujs
//= require 'jquery.mobile'
//= require_self  

移动.css

 *= require 'jquery.mobile'
 *= require_self

应用程序.mobile.erb

  <%= stylesheet_link_tag "mobile" %>
  <%= javascript_include_tag "mobile" %>

如何解决路由问题

4

0 回答 0