0

Dropdown menus work on localhost or Heroku, but not both depending on order in application.js

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require angular
//= require 'leaflet.js'
//= require leaflet
//= require_tree .

With the above dropdown menus work on Heroku https://secure-shore-68966.herokuapp.com/summary. To work on localhost bootstrap needs to be second, that is, above jquery_ujs.

This an old problem, e.g., Javascript features work on localhost but not when deployed to Heroku. I found the order solution in one of the comments. (The post is four years old, so the items differ a bit.)

production.rb file has config.assets.compile = true which I assume takes care of precompiling, but in any case I've tried rake assets:precompile before pushing to Heroku and that didn't help.

What might I have wrong? Or is there a workaround so I don't have to change application.js everytime I upload? I'm a newbie so my knowledge of asset management is weak to say the least.

10
  • how did u install bootstrap and angular? from gem or npm ? Commented Mar 30, 2016 at 20:41
  • Most likely a gem. I have been working through several tutorials and get bounced around a bit. Is there a way to tell? I don't use npm much. My Gemfile has source 'rails-assets.org' do gem 'rails-assets-bootstrap' gem 'rails-assets-angular' gem 'rails-assets-leaflet' end Also have in Bowerfile: asset 'angular', '~> 1.5' resolution 'angular', '1.5' asset 'angular-route' Not currently using angular. I experimented with it, but decided to abandon its use for now. Thanks for any help. Commented Mar 30, 2016 at 20:54
  • Are you using the 12factor gem for setting up assets on your deployed heroku app? Install that gem, then in your command line do: "bundle exec rake assets:precompile RAILS_ENV=production" Then do a git commit and push to heroku! Commented Mar 30, 2016 at 21:24
  • group :production do gem 'rails_12factor', '0.0.2' gem 'puma', '2.15.3' end has been in Gemfile all along. Is bundle exec rake assets:precompile different than bundle exec rake assets:precompile RAILS_ENV=production? Commented Mar 30, 2016 at 21:30
  • To be honest I am not sure and that makes me sad >< Commented Mar 30, 2016 at 21:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.