开发者

rails3 @ heroku: ActionController::RoutingError (No route matches "/javascripts/jquery.min"):

开发者 https://www.devze.com 2023-02-12 06:10 出处:网络
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 t

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 wou开发者_StackOverflowld 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>


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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号