[Nitro] render :index broken

George Moschovitis george.moschovitis at gmail.com
Sun Sep 16 02:18:19 EDT 2007


thanks!

-g.

On 9/16/07, Arne Brasseur <arne at arnebrasseur.net> wrote:
>
>  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
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general
>
>


-- 
http://www.me.gr
http://phidz.com
http://blog.gmosx.com
http://cull.gr
http://www.joy.gr
http://nitroproject.org


More information about the Nitro-general mailing list