Reputation: 25
I'm building a Rails app using Bootstrap for mobile scaling. When I deployed to Heroku, all my assets went missing. I thought that had been fixed in Rails 4, but anyway. I precompiled all the assets using 'rails_12factor'. Now all my images and styles are rendering just fine, but the dropdown menu inexplicably does nothing at all.
Am I doing something wrong in the compilation maybe? I went;
$ rake assets:precompile
$ git add .
$ git commit -a -m "Asset Fix"
$ git push heroku master
...and my menu broke.
Here's what it looks like now; http://rocky-crag-1181.herokuapp.com/
Resize your browser to recreate the break.
Repository at; https://github.com/SoundBank/soundbank02
Upvotes: 1
Views: 238
Reputation: 25
The redundant versions of jquery and bootstrap in my app/assets folder were clashing somehow during precompilation in production. I just deleted them from the directory, corrected my application.js, and ran another rake assets:precompile
That confused the problem. With the old scripts culled away, I was able to order jquery to load first, ( thanks SSR ).
Now both the responsive menu and the background carousel are playing nicely with jquery.
Incidentally, the base template was United by Bootswatch, and the bundled scripts I removed were;
bootstrap.js
jquery-1.10.2.min.js
I'll be watching more carefully for conflicting scripts in downloaded templates from now on.
Upvotes: 0
Reputation: 6438
Your application runs with two jQuery versions. rails provides latest jQuery version so no need to include extra versions. If you need to do so then replace
//= require jquery
this line with your jQuery file
//= require jquery-1.10.2.min.js
but remember your jQuery file should be in
app/assets/javascript/
Your application.html.erb
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
this line should be end of the file but before body close tag.
Now on terminal fire this commands
cd /sites/<app_name>
rm public/assets -R
rake assets:precompile
Here you go :D
Upvotes: 1