instance method
raise_nil_warning_for
Ruby on Rails 3.0.20
Since v2.2.3 Last seen in v3.0.20 PrivateSignature
raise_nil_warning_for(class_name = nil, selector = nil, with_caller = nil)
Raises a NoMethodError when you attempt to call a method on nil.
Parameters
-
class_nameopt = nil -
selectoropt = nil -
with_calleropt = nil
Source
# File activesupport/lib/active_support/whiny_nil.rb, line 53
def raise_nil_warning_for(class_name = nil, selector = nil, with_caller = nil)
message = "You have a nil object when you didn't expect it!"
message << "\nYou might have expected an instance of #{class_name}." if class_name
message << "\nThe error occurred while evaluating nil.#{selector}" if selector
raise NoMethodError, message, with_caller || caller
end
Defined in activesupport/lib/active_support/whiny_nil.rb line 53
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in NilClass