aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/whiny_nil.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-04 09:54:30 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-04 09:54:30 +0000
commit117ee110d7cbe199f94d2422eb20c0066eb41a10 (patch)
treeadc041ce85511d37cdaeef737e3c8dcfeeaf6f47 /activesupport/lib/active_support/whiny_nil.rb
parenta62485a0896c60a0c543e64a7f24ea37772bf97d (diff)
downloadrails-117ee110d7cbe199f94d2422eb20c0066eb41a10.tar.gz
rails-117ee110d7cbe199f94d2422eb20c0066eb41a10.tar.bz2
rails-117ee110d7cbe199f94d2422eb20c0066eb41a10.zip
Improved the whiny nil #1600 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/whiny_nil.rb')
-rw-r--r--activesupport/lib/active_support/whiny_nil.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/whiny_nil.rb b/activesupport/lib/active_support/whiny_nil.rb
index 5176e64185..9beba568c7 100644
--- a/activesupport/lib/active_support/whiny_nil.rb
+++ b/activesupport/lib/active_support/whiny_nil.rb
@@ -19,20 +19,20 @@ class NilClass
end
def id
- raise "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id"
+ raise RuntimeError, "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id", caller
end
private
def method_missing(method, *args, &block)
if @@method_class_map.include?(method)
- raise_nil_warning_for @@method_class_map[method]
+ raise_nil_warning_for @@method_class_map[method], caller
else
super
end
end
- def raise_nil_warning_for(klass)
- raise NoMethodError, NIL_WARNING_MESSAGE % klass
+ def raise_nil_warning_for(klass, with_caller = nil)
+ raise NoMethodError, NIL_WARNING_MESSAGE % klass, with_caller || caller
end
NIL_WARNING_MESSAGE = <<-end_message unless const_defined?(:NIL_WARNING_MESSAGE)