简体   繁体   中英

Need to add javascript to heroku

I have not added any javascript files except for the ones created by the scaffolds. IN the applications.html.erb file, there is a line that was pre generated:

  <%= javascript_include_tag "application" %>

Heroku does not like this. When I comment out this line, I can use my app but some of the routing is messed up. I was able to get around some of the routing problems by adding GET routes to the links that were giving me trouble. I am still having a problem with all the links that go to destroying something... like when I hit a destroy link (ie the one generated by the scaffold), it sends me to the show view for the thing I wanna delete.

Is there a way to fix this while leaving javascript commented out or do I have to do something to get javascript working? Also to note, this is my first RoR application.

If you haven't altered any settings i application.rb rails 3.1 will run with asset_pipeline.

http://guides.rubyonrails.org/asset_pipeline.html , in this guide you can read how rails combines script and minifies them.

When pushing to heroku (which also assumes asset pipeline if not altered) you probably not run

rake asset:precompile

and the commit the compiled assets.

I had the same problem and i solved it to use another stack. There is a beta stack for Rails 3.1 called Cedar.

You can use the Bamboo stack but not with the asset pipeline. You can change your stack too Cedar.

For more information: http://devcenter.heroku.com/articles/rails31_heroku_cedar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM