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

发布于 2024-10-18 15:18:44 字数 1775 浏览 1 评论 0原文

注意:通过将 javascript_include_tag:defaults 更改为 "application.js", "jquery.js", "rails.js" 来解决无论如何,只有 3 个文件,但在 Heroku 上,出于某种原因,它试图获取额外的 jquery.min ,除非我这样做。


(在本地运行我们看不到这一点,仅在 Heroku 上) 我们的 Heroku 日志显示,在每个 GET 请求之后,都会向 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"):

我无法弄清楚该 GET 请求来自哪里。

我们的 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)

public/javascripts 中仅有的 3 个文件是 application.js、jquery.js 和rails.js

FWIW 我们的应用程序正在使用 JSON 与远程服务器进行通信。

但我在我们的应用程序中找不到任何对“jquery.min”的引用(就此而言,为什么错误消息没有说 jquery.min.js?)

jquery.min.js 是我应该的文件吗? /em> 有吗?如果是这样,我从哪里获取并安装它?

我知道在另一个应用程序的早期迭代中(我们复制来启动这个应用程序),开发人员说了一些关于使用 jquery.min 来混淆一些我们不再包含的 js 代码的事情。


需要注意的是:当查看 Heroku 托管的页面的页面源时,神秘的“jquery.min”(没有 js)就在那里。 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>

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.


(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:

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.

Our layouts/application.html.haml says:

  %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

FWIW our app is using JSON to communicate with a remote server.

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?)

Is jquery.min.js a file I should have? 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).


One note: when looking at the page source of the page hosted at Heroku the mystery "jquery.min" (no js) is right there. FWIW it does not have the ?1298317536 after it)

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

风向决定发型 2024-10-25 15:18:44

config/application.rb 文件中列出了哪些 js 文件?你有这样的东西吗?

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

如果是,只需从 jquery 中删除 .min,一切都会好起来的。

编辑:当然,只要您将 jquery.js 放入您的 javascripts 文件夹中...:-)

编辑2:看看您的 /public/javascripts 文件夹。里面有什么文件?

What are the js files listed in your config/application.rb file? 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.

EDIT: As long, of course, as you have jquery.js into your javascripts folder... :-)

EDIT2: Take a look at your /public/javascripts folder. What are the files in there?

忆梦 2024-10-25 15:18:44

通过将 javascript_include_tag:defaults 更改为 "application.js", "jquery.js", "rails.js" 来解决,这是唯一的无论如何,有 3 个文件,但在 Heroku 上,出于某种原因,它会尝试获取额外的 jquery.min ,除非我这样做。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文