So, the app was working great locally until I prepiled the assets. When deploying to heroku I did assets prepile 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?
So, the app was working great locally until I prepiled the assets. When deploying to heroku I did assets prepile 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?
Share Improve this question edited Nov 11, 2013 at 16:01 Ismael asked Jun 15, 2012 at 17:18 IsmaelIsmael 16.7k6 gold badges63 silver badges76 bronze badges 2- Have you tried running in the same environment (production, staging, etc...) locally as you're running on Heroku? – badams Commented Jun 15, 2012 at 17:40
- 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/assets – Ismael Commented Jun 15, 2012 at 18:02
1 Answer
Reset to default 11Finally 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 prepile and keep your master branch clean.
Other alternative is to run prepile 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