Skip to content Skip to sidebar Skip to footer

JQuery Is Included Twice In Rails Application On Heroku

My question is similar to some other questions here which still didn't provide an answer for my situation I am including jQuery gem in my app in Gemfile: gem 'jquery-rails' And in

Solution 1:

I removed this line

//= require_tree .

and creating a sub folder in javascripts and then moved all js files in javascript directory to that subfolder except application.js

and wrote this line

//= require_tree ./sub_folder_name

It's awsome and working.

One Important thing to Note:

This may cause to you as you are including a same file twice one manually by javascript_include_tag and other by application.js. First confirm that if this is the case you have to include it once.


Solution 2:

Take a look at this article on heroku regarding precompiling your assets. When you push to heroku do you see any error messages around the section that says:

-----> Preparing Rails asset pipeline
       Running: rake assets:precompile

?


Solution 3:

Development and Production and supposed to be different (/app/assets and not minified in development, public/assets and minified in production.

As for the double-include, if your production web served page has both, I would check your app for pages like application.html.erb to see if if it's defined there. If so, remove it.


Post a Comment for "JQuery Is Included Twice In Rails Application On Heroku"