ruby on rails - jQuery Event listeners not working on Heroku Production -


so have small problem driving me nuts.

i have rails 4 app utilizes jquery event listeners. these working great on development , staging. when push production aren't getting set.

it worth mentioning 'staging' cedar-14 app on heroku 'production'.

the difference being rails_env = 'staging' instead of 'production'.

if initialize listeners using console, work great. changing production rails_env 'staging' listeners work too.

my production.rb , staging.rb identical. right assets not being uglified or , far can see, being served client in identical fashion.

so question getting set rails_env in production preventing of '$.on' listeners getting set?

the versions

jquery 1.11.1 rails 4.1.4 ruby 2.2.0 turbolinks 2.3.o 

double check order of gems in application.js

//= require jquery //= require jquery.turbolinks //= require jquery_ujs //= require turbolinks 

next step, make sure minification not causing issue. add gem 'uglifier' gemfile, , following production.rb config.assets.js_compressor = uglifier.new(:mangle => false)

does jquery code execute? if not , uglifer did not fix issue, reference jquery jquery(document) instead of $(document)

still broke? enable asset compilation fallback adding config.assets.compile = true production.rb.

if adding compilation fallback works, there may issue in asset pipeline. don't use heroku much, make sure assets wiped on environment rake assets:clobber , asset compilation being executed on deploy rake asset:precompile

if still broken, please post file listeners.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -