aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-03-24 23:43:37 +0100
committerXavier Noria <fxn@hashref.com>2011-04-13 13:23:16 +0200
commit096fa1b60f537c7c30db35f5576ab351c67a5064 (patch)
tree7a66e8bfe57359f6a6a20ffa0cd10602b3e4637d /railties/guides
parent805126b20a39c6f05c46bff780245b0e1c6bc046 (diff)
downloadrails-096fa1b60f537c7c30db35f5576ab351c67a5064.tar.gz
rails-096fa1b60f537c7c30db35f5576ab351c67a5064.tar.bz2
rails-096fa1b60f537c7c30db35f5576ab351c67a5064.zip
jQuery is the new default
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/source/layouts_and_rendering.textile14
1 files changed, 12 insertions, 2 deletions
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" %>
</erb>
-The +defaults+ option loads the Prototype and Scriptaculous libraries:
+The +:defaults+ option loads jQuery by default:
<erb>
<%= javascript_include_tag :defaults %>
</erb>
-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" <tt>:defaults</tt> loads Prototype and Scriptaculous. And you can in any case override the expansion in <tt>config/application.rb</tt>:
+
+<ruby>
+config.action_view.javascript_expansions[:defaults] = %w(foo.js bar.js)
+</ruby>
+
+When using <tt>:defaults</tt>, if an <tt>application.js</tt> file exists in <tt>public/javascripts</tt> it will be included as well at then end.
+
+The +:all+ option loads every JavaScript file in +public/javascripts+:
<erb>
<%= javascript_include_tag :all %>
</erb>
+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:
<erb>