Browse files

Merge remote branch 'docrails/master'

  • Loading branch information...
2 parents f1b33f7 + 2856901 commit 137e4e759a7360f6277ec469d165894bf96dbabf @fxn fxn committed Aug 17, 2010
@@ -5,7 +5,7 @@
module ClassInheritableAttributes # :nodoc:
-# It is recommend to use <tt>class_attribute</tt> over methods defined in this file. Please
+# It is recommended to use <tt>class_attribute</tt> over methods defined in this file. Please
# refer to documentation for <tt>class_attribute</tt> for more information. Officially it is not
# deprecated but <tt>class_attribute</tt> is faster.
@@ -96,23 +96,25 @@ Will be rendered as follows:
Title: Rails debugging guide
-h4. Debugging JavaScript
+h4. Debugging RJS
-Rails has built-in support to debug RJS, to active it, set +ActionView::Base.debug_rjs+ to _true_, this will specify whether RJS responses should be wrapped in a try/catch block that alert()s the caught exception (and then re-raises it).
+Rails has optional built-in support to debug RJS. When enabled, responses are wrapped in a try/catch block that displays the caught exception using +alert()+, and then re-raises it.
-To enable it, add the following in the +Rails::Initializer do |config|+ block inside +environment.rb+:
+The flag to enable RJS debugging in your configuration files is +config.action_view.debug_rjs+:
-config.action_view[:debug_rjs] = true
+config.action_view.debug_rjs = true
-Or, at any time, setting +ActionView::Base.debug_rjs+ to _true_:
+or at any time setting +ActionView::Base.debug_rjs+:
ActionView::Base.debug_rjs = true
-TIP: For more information on debugging javascript refer to "Firebug":, the popular debugger for Firefox.
+It is enabled by default in development mode, and disabled in the rest.
+TIP: For more information on debugging JavaScript, refer to "Firebug":, the popular debugger for Firefox.
h3. The Logger
@@ -231,6 +231,17 @@ end
Now, when you call the +books_path+ method you should get +"/en/books"+ (for the default locale). An URL like +http://localhost:3001/nl/books+ should load the Netherlands locale, then, and following calls to +books_path+ should return +"/nl/books"+ (because the locale changed).
+If you don't want to force the use of a locale in your routes you can use an optional path scope (donated by the use brackets) like so:
+# config/routes.rb
+scope "(:locale)", :locale => /en|nl/ do
+ resources :books
+With this approach you will not get a +Routing Error+ when accessing your resources such as +http://localhost:3001/books+ without a locale. This is useful for when you want to use the default locale when one is not specified.
Of course, you need to take special care of the root URL (usually "homepage" or "dashboard") of your application. An URL like +http://localhost:3001/nl+ will not work automatically, because the +root :to => "books#index"+ declaration in your +routes.rb+ doesn't take locale into account. (And rightly so: there's only one "root" URL.)
You would probably need to map URLs like these:

0 comments on commit 137e4e7

Please sign in to comment.