[Nitro] render :index broken

Arne Brasseur arne at arnebrasseur.net
Sun Sep 16 00:15:27 EDT 2007


There you go. Both patches are included.

(ab)

George Moschovitis schreef:
> thanks, for this patch. Is it possible that you add to the spec file:
>
> test/raw/dispatcher.rb
>
> a test for this?
>
> thank you.
>
> -g.
>
> On 9/15/07, Arne Brasseur <arne at arnebrasseur.net> wrote:
>   
>> 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
>>
>>
>> _______________________________________________
>> Nitro-general mailing list
>> Nitro-general at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/nitro-general
>>
>>
>>     
>
>
>   


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20070916/3b356b37/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bundle_ab_20070916.patch
Type: text/x-patch
Size: 64441 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20070916/3b356b37/attachment-0001.bin 


More information about the Nitro-general mailing list