Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #1600: hidden-whiny-nil.patch

File hidden-whiny-nil.patch, 2.5 kB (added by Ulysses, 3 years ago)

Patch as discussed

  • activesupport/lib/active_support/whiny_nil.rb

    old new  
    1919  end 
    2020   
    2121  def id 
    22     raise "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id" 
     22    raise RuntimeError, "Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id", caller 
    2323  end 
    2424 
    2525  private 
    2626    def method_missing(method, *args, &block) 
    2727      if @@method_class_map.include?(method) 
    28         raise_nil_warning_for @@method_class_map[method] 
     28        raise_nil_warning_for @@method_class_map[method], caller 
    2929      else 
    3030        super 
    3131      end 
    3232    end 
    3333 
    34     def raise_nil_warning_for(klass
    35       raise NoMethodError, NIL_WARNING_MESSAGE % klass 
     34    def raise_nil_warning_for(klass, with_caller = nil
     35      raise NoMethodError, NIL_WARNING_MESSAGE % klass, with_caller || caller 
    3636    end 
    3737 
    3838    NIL_WARNING_MESSAGE = <<-end_message unless const_defined?(:NIL_WARNING_MESSAGE) 
  • railties/html/500.html

    old new  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    2    "http://www.w3.org/TR/html4/loose.dtd"> 
    31<html> 
    42<body> 
    53  <h1>Application error (Apache)</h1> 
  • railties/html/404.html

    old new  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    2    "http://www.w3.org/TR/html4/loose.dtd"> 
    31<html> 
    42<body> 
    53  <h1>File not found</h1> 
  • railties/html/index.html

    old new  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
    2    "http://www.w3.org/TR/html4/loose.dtd"> 
    31<html> 
    42<head> 
    53  <title>Rails: Welcome on board</title>