Skip to content

Commit

Permalink
Add a deprecation warning about config.action_view.debug_rjs.
Browse files Browse the repository at this point in the history
Upgrading to 3.1 removes debug_rjs and upgraded apps will fail to start up.
  • Loading branch information
NZKoz committed May 17, 2011
1 parent 2004fb9 commit b03da24
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion actionpack/lib/action_view/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,12 @@ module Subclasses

# Specify whether RJS responses should be wrapped in a try/catch block
# that alert()s the caught exception (and then re-raises it).
cattr_accessor :debug_rjs
cattr_reader :debug_rjs
@@debug_rjs = false
def self.debug_rjs=(new_value)
ActiveSupport::Deprecation.warn("config.action_view.debug_rjs will be removed in 3.1, from 3.1 onwards you will need to install prototype-rails to continue to use RJS templates ")
@@debug_rjs = new_value
end

# Specify the proc used to decorate input tags that refer to attributes with errors.
cattr_accessor :field_error_proc
Expand Down
8 changes: 6 additions & 2 deletions actionpack/test/template/prototype_helper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,15 @@ def test_collection_proxy_with_each_slice
end

def test_debug_rjs
ActionView::Base.debug_rjs = true
assert_deprecated /prototype-rails/ do
ActionView::Base.debug_rjs = true
end
@generator['welcome'].replace_html 'Welcome'
assert_equal "try {\n$(\"welcome\").update(\"Welcome\");\n} catch (e) { alert('RJS error:\\n\\n' + e.toString()); alert('$(\\\"welcome\\\").update(\\\"Welcome\\\");'); throw e }", @generator.to_s
ensure
ActionView::Base.debug_rjs = false
assert_deprecated /prototype-rails/ do
ActionView::Base.debug_rjs = false
end
end

def test_literal
Expand Down

0 comments on commit b03da24

Please sign in to comment.