Skip to content Skip to sidebar Skip to footer

Rails: Jquery Works In Localhost But Not In Production On Heroku

When I go to localhost:3000 it works but as soon I push it to heroku it doesn't work. What am I doing wrong? I am using mailboxer gem. I've run bundle exec rake assets:precompile

Solution 1:

When you ran rake assets:precompile, did you remember to check in those results into git. If you didn't then they won't be pushed to heroku and therefore not be able to be consumed.

The fix you suggested is probably not what you want long term, because it puts more strain on your servers and make them act like they would in development, where with every request the assets are 'evaluated' dynamically.

Work towards a procedure for your deploy where you are compiling locally and checking them in for the deploy, or not having any assets compiled and letting heroku compile them for you.

Cheers

J

Solution 2:

I fixed it by adding config.assets.debug = true to the production.rb

Post a Comment for "Rails: Jquery Works In Localhost But Not In Production On Heroku"