[Nitro] render :index broken

Arne Brasseur arne at arnebrasseur.net
Sat Sep 15 10:06:48 EDT 2007


Patch included. This solves redirecting to the index method of the root 
controller.

(ab)

Arne Brasseur schreef:
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle_ab_20070915.patch
Type: text/x-patch
Size: 63987 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070915/ce68c0e5/attachment-0001.bin 


More information about the Nitro-general mailing list