开发者

javascript_include_tag not working

i'm using a javascript_include_tag in one of my 'partial' rhtml files. yet, when the page loads, I get an error in firebug saying that the class included in the javascript file was not defined. Basically, the javascript file is not getting added. I have kept the js file in the public/javascripts folder

Please hel开发者_如何学JAVAp


First, what version of rails are you running? I know with my version of rails(3.1.1) the javascript_include_tag defaults to the app/assets/javascript directory not the public/javascripts folder. Placing files in the assets/javascript folder should allow you to properly link to them in a similar fashion.

This will include all js files residing in the assets/javascript folder and should already be at the top of your views/layout/application.html.erb file.

<%= javascript_include_tag "application" %>

Also any subdirectories will be included by the above tag. Hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜