Exception: ActionController::UrlGenerationError
- Inherits:
 - 
      ActionControllerError
      
        
- Object
 - StandardError
 - ActionControllerError
 - ActionController::UrlGenerationError
 
 
- Includes:
 - DidYouMean::Correctable
 
- Defined in:
 - lib/action_controller/metal/exceptions.rb
 
Overview
:nodoc:
Instance Attribute Summary collapse
- 
  
    
      #method_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute method_name.
 - 
  
    
      #route_name  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute route_name.
 - 
  
    
      #routes  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute routes.
 
Instance Method Summary collapse
- #corrections ⇒ Object
 - 
  
    
      #initialize(message, routes = nil, route_name = nil, method_name = nil)  ⇒ UrlGenerationError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of UrlGenerationError.
 
Constructor Details
#initialize(message, routes = nil, route_name = nil, method_name = nil) ⇒ UrlGenerationError
Returns a new instance of UrlGenerationError.
      28 29 30 31 32 33 34  | 
    
      # File 'lib/action_controller/metal/exceptions.rb', line 28 def initialize(, routes = nil, route_name = nil, method_name = nil) @routes = routes @route_name = route_name @method_name = method_name super() end  | 
  
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
      26 27 28  | 
    
      # File 'lib/action_controller/metal/exceptions.rb', line 26 def method_name @method_name end  | 
  
#route_name ⇒ Object (readonly)
Returns the value of attribute route_name.
      26 27 28  | 
    
      # File 'lib/action_controller/metal/exceptions.rb', line 26 def route_name @route_name end  | 
  
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
      26 27 28  | 
    
      # File 'lib/action_controller/metal/exceptions.rb', line 26 def routes @routes end  | 
  
Instance Method Details
#corrections ⇒ Object
      39 40 41 42 43 44 45 46  | 
    
      # File 'lib/action_controller/metal/exceptions.rb', line 39 def corrections @corrections ||= begin maybe_these = routes&.named_routes&.helper_names&.grep(/#{route_name}/) || [] maybe_these -= [method_name.to_s] # remove exact match DidYouMean::SpellChecker.new(dictionary: maybe_these).correct(route_name) end end  |