Rails 3.1 Production - Javascript loads, but doesn

2019-06-14 01:02发布

问题:

I've just uploaded my app to the heroku servers (with cedar stack) "http://hollow-waterfall-4266.herokuapp.com/" and I can see that the files load and are there, but they don't execute.

The css-file is fine and working, but the javascript files aren't. I've looked at a lot of other posts, but nobody seems to have the answer and I have no idea of where to start to debug this.

Any suggestions?

回答1:

Your page is throwing "jQuery is not defined" errors. Your page's source looks like this:

<script src="/assets/jquery-9750cb66f964a0901c68c61b399928dc.rails" type="text/javascript"></script>
<script src="/assets/jquery-1.4.4-d1fb061dfe072deb1a689fdc40b2debe.min" type="text/javascript"></script>
<script src="/assets/countdown-1a430b19ccddfaa55e613c153529478d.js" type="text/javascript"></script>
<script src="/assets/jquery-1e7a267339e7c1853437734d5040d838.infieldlabel" type="text/javascript"></script>
<script src="/assets/charCount-0f5848b48fc67330a2532bbce115bc9c.js" type="text/javascript"></script>
<script src="/assets/application-0dd84c1347591b7d784745c6f5602f7b.js" type="text/javascript"></script>

jQuery should be the first JS file you load before any others. Right now, the unobtrusive JS file is loaded before the actual jQuery 1.4.4 file. Also, it looks like the link to the jQuery file (jquery-1.4.4-d1fb061dfe072deb1a689fdc40b2debe.min) doesn't work.



回答2:

I had messed up my whole asset pipeline. Started a new rails app.