简体   繁体   English

rails3 @ heroku:ActionController :: RoutingError(没有路由匹配“ /javascripts/jquery.min”):

[英]rails3 @ heroku: ActionController::RoutingError (No route matches “/javascripts/jquery.min”):

NOTE: SOLVED by changing javascript_include_tag from :defaults to "application.js", "jquery.js", "rails.js" which ar the ONLY 3 files anyway, but on Heroku for some reason it's trying to grab that extra jquery.min unless I do it this way. 注意:通过将javascript_include_tag:defaults更改为"application.js", "jquery.js", "rails.js" ,无论如何它只能保存3个文件,但是在Heroku上由于某种原因,它试图获取多余的jquery.min除非我这样做


(running locally we do not see this, just on Heroku) Our Heroku logs show, after every GET request, another GET request to jquery.min which gives a routing error: (在本地运行,仅在Heroku上看不到)。在每个GET请求之后,我们的Heroku日志显示另一个对jQuery.min的GET请求,该请求给出了路由错误:

Started GET "/javascripts/jquery.min" for 1.2.3.4 at 2011-02-21 19:32:27 -0800
ActionController::RoutingError (No route matches "/javascripts/jquery.min"):

I can't figure out where that GET request is coming from. 我不知道该GET请求来自何处。

Our layouts/application.html.haml says: 我们的layouts / application.html.haml说:

  %head
    %title
      = yield(:title) || "Untitled"
    %meta{"http-equiv"=>"Content-Type", :content=>"text/html; charset=utf-8"}/
    = stylesheet_link_tag "application"
    = javascript_include_tag :defaults
    = csrf_meta_tag
    = yield(:head)

and the only 3 files in public/javascripts are application.js, jquery.js, and rails.js 并且public / javascript中仅有的3个文件是application.js,jquery.js和rails.js

FWIW our app is using JSON to communicate with a remote server. FWIW我们的应用程序正在使用JSON与远程服务器进行通信。

But I cannot find any reference to "jquery.min" in our app (and for that matter, why doesn't the error message say jquery.min.js?) 但是我在我们的应用程序中找不到对“ jquery.min”的任何引用(因此,为什么错误消息中没有显示jquery.min.js?)

Is jquery.min.js a file I should have? jquery.min.js是我应该拥有的文件吗? If so, where would I get that and install that? 如果是这样,我将在哪里安装它?

I know in an earlier iteration of another app (we copied to start this app) a developer said something about using jquery.min to obfuscate some js code which we no longer have included). 我知道在另一个应用程序的早期迭代中(我们复制以启动该应用程序),开发人员说了一些有关使用jquery.min混淆​​一些我们不再包含的js代码的信息。


One note: when looking at the page source of the page hosted at Heroku the mystery "jquery.min" (no js) is right there. 一个注意事项:当查看Heroku托管的页面的页面源时,神秘的“ jquery.min”(没有js)就在那里。 FWIW it does not have the ?1298317536 after it) FWIW之后没有?1298317536)

<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<link href="/stylesheets/application.css?1298317536" media="screen" rel="stylesheet" type="text/css" />
<script src="/javascripts/jquery.min" type="text/javascript"></script>
<script src="/javascripts/rails.js?1298317536" type="text/javascript"></script>
<script src="/javascripts/application.js?1298317536" type="text/javascript"></script>

What are the js files listed in your config/application.rb file? config / application.rb文件中列出了哪些js文件? Do you have something like this? 你有这样的东西吗?

config.action_view.javascript_expansions[:defaults] = %w(jquery.min rails)

If yes, just remove the .min from the jquery, and everything should be fine. 如果是,只需从jquery中删除.min,一切就可以了。

EDIT: As long, of course, as you have jquery.js into your javascripts folder... :-) 编辑:当然,只要您将jquery.js放入javascripts文件夹... :-)

EDIT2: Take a look at your /public/javascripts folder. EDIT2:查看您的/ public / javascripts文件夹。 What are the files in there? 里面有什么文件?

通过将javascript_include_tag:defaults更改为"application.js", "jquery.js", "rails.js" ,无论如何它只能保存3个文件,但是在Heroku上由于某种原因,它试图获取多余的jquery.min除非我用这种方式做。

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

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