开发者

Need to add javascript to heroku

开发者 https://www.devze.com 2023-04-12 11:05 出处:网络
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:

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_in开发者_开发知识库clude_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 (i.e. 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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号