From 2a55edc725a4272c732dc93bd6aaec9ed0aa20cc Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Mon, 16 Aug 2010 05:25:40 -0500 Subject: Debugging Guide: Improve grammar for the RJS section --- railties/guides/source/debugging_rails_applications.textile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/debugging_rails_applications.textile b/railties/guides/source/debugging_rails_applications.textile index 26aee82ae1..ccd538d1e8 100644 --- a/railties/guides/source/debugging_rails_applications.textile +++ b/railties/guides/source/debugging_rails_applications.textile @@ -98,7 +98,7 @@ Title: Rails debugging guide h4. Debugging JavaScript -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 built-in support to debug RJS – to activate it, set +ActionView::Base.debug_rjs+ to _true_. This will specify that RJS responses should be 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+: @@ -106,13 +106,13 @@ To enable it, add the following in the +Rails::Initializer do |config|+ block in config.action_view[:debug_rjs] = true -Or, at any time, setting +ActionView::Base.debug_rjs+ to _true_: +Or, at any time, set +ActionView::Base.debug_rjs+ to _true_: ActionView::Base.debug_rjs = true -TIP: For more information on debugging javascript refer to "Firebug":http://getfirebug.com/, the popular debugger for Firefox. +TIP: For more information on debugging JavaScript, refer to "Firebug":http://getfirebug.com/, the popular debugger for Firefox. h3. The Logger -- cgit v1.2.3 From 9a665aa6d24e56f7c990cbdcd9a6e43188f75f94 Mon Sep 17 00:00:00 2001 From: Josiah Ivey Date: Mon, 16 Aug 2010 21:32:08 -0500 Subject: Debugging Guide: Highlight using config over ActionView::Base --- railties/guides/source/debugging_rails_applications.textile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/debugging_rails_applications.textile b/railties/guides/source/debugging_rails_applications.textile index ccd538d1e8..07c6f6b65d 100644 --- a/railties/guides/source/debugging_rails_applications.textile +++ b/railties/guides/source/debugging_rails_applications.textile @@ -98,20 +98,20 @@ Title: Rails debugging guide h4. Debugging JavaScript -Rails has built-in support to debug RJS – to activate it, set +ActionView::Base.debug_rjs+ to _true_. This will specify that RJS responses should be 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+: +Rails has built-in support to debug RJS. To enable it, add the following in the +Rails::Initializer do |config|+ block inside +environment.rb+: config.action_view[:debug_rjs] = true -Or, at any time, set +ActionView::Base.debug_rjs+ to _true_: +Or, at any time, set +ActionView::Base.debug_rjs+ to true: ActionView::Base.debug_rjs = true +This will specify that RJS responses should be wrapped in a try/catch block that displays the caught exception using +alert()+ (and then re-raises it). + TIP: For more information on debugging JavaScript, refer to "Firebug":http://getfirebug.com/, the popular debugger for Firefox. h3. The Logger -- cgit v1.2.3 From 95ecc08a30c4f5e8e59608777e3d98adf28fa693 Mon Sep 17 00:00:00 2001 From: Luke Brown Date: Tue, 17 Aug 2010 09:48:12 +0100 Subject: Added an example and explaination for using an optional path scope for the locale --- railties/guides/source/i18n.textile | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'railties') diff --git a/railties/guides/source/i18n.textile b/railties/guides/source/i18n.textile index 1af51af80e..6018cc44c8 100644 --- a/railties/guides/source/i18n.textile +++ b/railties/guides/source/i18n.textile @@ -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 +end + + +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: -- cgit v1.2.3 From 285690143ea80fe504385a409cdc28f0d9b7ada2 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 17 Aug 2010 13:19:00 +0200 Subject: debugging guide: revises the section on debugging RJS --- railties/guides/source/debugging_rails_applications.textile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'railties') diff --git a/railties/guides/source/debugging_rails_applications.textile b/railties/guides/source/debugging_rails_applications.textile index 07c6f6b65d..35069f33ad 100644 --- a/railties/guides/source/debugging_rails_applications.textile +++ b/railties/guides/source/debugging_rails_applications.textile @@ -96,21 +96,23 @@ Will be rendered as follows: Title: Rails debugging guide -h4. Debugging JavaScript +h4. Debugging RJS -Rails has built-in support to debug RJS. To enable it, add the following in the +Rails::Initializer do |config|+ block inside +environment.rb+: +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. + +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, set +ActionView::Base.debug_rjs+ to true: +or at any time setting +ActionView::Base.debug_rjs+: ActionView::Base.debug_rjs = true -This will specify that RJS responses should be wrapped in a try/catch block that displays the caught exception using +alert()+ (and then re-raises it). +It is enabled by default in development mode, and disabled in the rest. TIP: For more information on debugging JavaScript, refer to "Firebug":http://getfirebug.com/, the popular debugger for Firefox. -- cgit v1.2.3