From 096fa1b60f537c7c30db35f5576ab351c67a5064 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Thu, 24 Mar 2011 23:43:37 +0100 Subject: jQuery is the new default --- railties/guides/source/layouts_and_rendering.textile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'railties/guides') diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index 1548da0eb5..8ea63f2ce3 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -707,18 +707,28 @@ To include +http://example.com/main.js+: <%= javascript_include_tag "http://example.com/main.js" %> -The +defaults+ option loads the Prototype and Scriptaculous libraries: +The +:defaults+ option loads jQuery by default: <%= javascript_include_tag :defaults %> -The +all+ option loads every JavaScript file in +public/javascripts+, starting with the Prototype and Scriptaculous libraries: +If the application was generated with "-j prototype" :defaults loads Prototype and Scriptaculous. And you can in any case override the expansion 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 then end. + +The +:all+ option loads every JavaScript file in +public/javascripts+: <%= javascript_include_tag :all %> +Note that your defaults of choice will be included first, so they will be available to all subsequently included files. + You can supply the +:recursive+ option to load files in subfolders of +public/javascripts+ as well: -- cgit v1.2.3