3
votes

So, the app was working great locally until I precompiled the assets. When deploying to heroku I did assets precompile and then deployed and it worked fine at heroku, but now it seems javascript got broken.

Any suggestions on how to solve it? Should I delete the files at public folder or use some configuration?

Thanks in advance

UPDATE

I get one of this for each asset file I load in development mode, is it normal?

Started GET "/assets/home.js?body=1" for 127.0.0.1 at 2012-06-15 19:16:48 +0100
Served asset /home.js - 304 Not Modified (0ms)

This is odd. I'm using twitter bootstrap and now to test if javascript is messed up I added a tooltip html example to check if it is also crashed and it actually worked.

But my dropdown at menu bar does not work. How strange is this?

1
Have you tried running in the same environment (production, staging, etc...) locally as you're running on Heroku?badams
I did now in production environment. It even can't load css. I don't know why. It says application-XXXXXXXXXXX.css cannot be found but it is at public/assetsIsmael

1 Answers

11
votes

Finally I solved the problem.

Just changed in config/environments/development.rb

config.assets.debug = true

to

config.assets.debug = false

And now javascript works as expected

UPDATE

Now when I have this problem I actually run rake assets:clean and clean the browser cache. This will make your app work as it used to work in development work.

If you want to have a better process, you could instead create a new branch where you run precompile and keep your master branch clean.

Other alternative is to run precompile on heroku so you don't have to do it locally. I haven't tried it yet but there is a 'beta' feature you have to enable so this can work properly in all apps. You can read about it here