Skip to content

Commit

Permalink
Merge [5535], [5536] from trunk.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5537 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Nov 16, 2006
1 parent 629b2ac commit a5631a5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*

* Deprecate standalone components. [Jeremy Kemper]

* Always clear model associations from session. #4795 [sd@notso.net, andylien@gmail.com]

* Update to Prototype 1.5.0_rc2. [Sam Stephenson]
Expand Down
2 changes: 2 additions & 0 deletions actionpack/lib/action_controller/components.rb
Expand Up @@ -80,6 +80,8 @@ def uses_component_template_root

self.template_root = path_of_controller_root
end

deprecate :uses_component_template_root => 'Components are deprecated and will be removed in Rails 2.0.'
end

module InstanceMethods
Expand Down
4 changes: 3 additions & 1 deletion actionpack/test/controller/components_test.rb
Expand Up @@ -143,6 +143,8 @@ def self.caller

class UsesComponentTemplateRootTest < Test::Unit::TestCase
def test_uses_component_template_root
assert_equal './test/fixtures/', A::B::C::NestedController.uses_component_template_root
assert_deprecated 'uses_component_template_root' do
assert_equal './test/fixtures/', A::B::C::NestedController.uses_component_template_root
end
end
end
20 changes: 17 additions & 3 deletions activesupport/lib/active_support/deprecation.rb
Expand Up @@ -51,13 +51,27 @@ def silence

private
def deprecation_message(callstack, message = nil)
file, line, method = extract_callstack(callstack)
message ||= "You are using deprecated behavior which will be removed from Rails 2.0."
"DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. (called from #{method} at #{file}:#{line})"
"DEPRECATION WARNING: #{message} See http://www.rubyonrails.org/deprecation for details. #{deprecation_caller_message(callstack)}"
end

def deprecation_caller_message(callstack)
file, line, method = extract_callstack(callstack)
if file
if line && method
"(called from #{method} at #{file}:#{line})"
else
"(called from #{file}:#{line})"
end
end
end

def extract_callstack(callstack)
callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures
if md = callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
md.captures
else
callstack.first
end
end
end

Expand Down

0 comments on commit a5631a5

Please sign in to comment.