开发者

ruby on rails javascript_include_tag :defaults

What the how the, where the..

<%= javascript_include_tag :defaults %>

this little evil line is pulling in 3 additional JavaScript that I could essentially give less then a damn about. In fact I would like to use that to redefine some defaults on a per page basis. However I can't seem to figure out where those defaults are defined.

Ive been on google and bing looking for answers bu开发者_JAVA百科t I yield none. I keep coming up with a document or 3 that explain using it, but not how I can use it.


Use the Rails API documentation for this.

If the application is not using the asset pipeline, to include the default JavaScript expansion pass :defaults as source. By default, :defaults loads jQuery, and that can be overridden in config/application.rb:

config.action_view.javascript_expansions[:defaults] = %w(foo.js bar.js)

When using :defaults, if an application.js file exists in public/javascripts it will be included as well at the end.


For rails 6 may use javascript_pack_tag 'application', 'data-turbolinks-track': 'reload'

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜