[Nitro] render :index broken

Arne Brasseur arne at arnebrasseur.net
Mon Sep 10 04:28:41 EDT 2007


When doing "render :index " in a controller action, the following gives 
me an error:

  #dispatcher.rb line 142

  def dispatch(uri, method = :get) 
    # Extract the query string.  
   
    path, query = uri.split("?", 2)     # <-------  uri == ""   then 
path == query == nil

    path ||= ""   # <------ This solves the problem

    # Try to route the path.
   
    path = @router.route(path) if @router

    # The characters after the last '.' in the path form the
    # extension that itself represents the expected response
    # content type.
   
    ext = File.extname(path)[1..-1] || "html"   # <------------  extname 
don't like no nil
    ....

So if uri.length == 0, then uri.split('?') returns [], so path and query 
are both nil. The call to File.extname fails because of this.

I solved this by adding the path ||= "", does this look like a good 
solution? Should I make a patch?

thx,
(ab)

-- 
Arne Brasseur
http://www.arnebrasseur.net
arne at arnebrasseur.net



More information about the Nitro-general mailing list