From 3589871de82c12123f62c80b4924d2696412065c Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Mon, 13 Mar 2006 02:11:59 +0000 Subject: Added simple alert() notifications for RJS exceptions when config.action_view.debug_rjs = true. Set debug_rjs = true for the default development environment. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3856 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 + actionpack/lib/action_view/base.rb | 5 +++ .../lib/action_view/helpers/prototype_helper.rb | 21 +++++++---- actionpack/test/controller/mime_responds_test.rb | 2 +- actionpack/test/controller/new_render_test.rb | 2 +- actionpack/test/template/prototype_helper_test.rb | 44 +++++++++++++--------- 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 5924b240da..aa1ddd1a08 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added simple alert() notifications for RJS exceptions when config.action_view.debug_rjs = true. [Sam Stephenson] + * Added :content_type option to render, so you can change the content type on the fly [DHH]. Example: render :action => "atom.rxml", :content_type => "application/atom+xml" * CHANGED DEFAULT: The default content type for .rxml is now application/xml instead of type/xml, see http://www.xml.com/pub/a/2004/07/21/dive.html for reason [DHH] diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 95afff0e84..94e7a47232 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -162,6 +162,11 @@ module ActionView #:nodoc: # shortly. @@local_assigns_support_string_keys = true cattr_accessor :local_assigns_support_string_keys + + # Specify whether RJS responses should be wrapped in a try/catch block + # that alert()s the caught exception (and then re-raises it). + @@debug_rjs = false + cattr_accessor :debug_rjs @@template_handlers = {} diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index 1f6aa274db..7781612180 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -370,12 +370,12 @@ module ActionView end private - def include_helpers_from_context - @context.extended_by.each do |mod| - extend mod unless mod.name =~ /^ActionView::Helpers/ + def include_helpers_from_context + @context.extended_by.each do |mod| + extend mod unless mod.name =~ /^ActionView::Helpers/ + end + extend GeneratorMethods end - extend GeneratorMethods - end # JavaScriptGenerator generates blocks of JavaScript code that allow you # to change the content and presentation of multiple DOM elements. Use @@ -425,7 +425,12 @@ module ActionView #