Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

spaces in URL

This is a workaround to get spaces in URL as pluses not %20 like it is in Rails2.

   1  
   2  module ActionController::Routing
   3    class DynamicSegment
   4      def interpolation_chunk
   5        "\#{CGI.escape(#{local_name}.to_s)}"
   6      end
   7  
   8      def match_extraction(next_capture)
   9        default_value = default ? default.inspect : nil
  10        %[
  11          value = if (m = match[#{next_capture}])
  12            CGI.unescape(m)
  13          else
  14            #{default_value}
  15          end
  16          params[:#{key}] = value if value
  17        ]
  18      end
  19    end
  20  end
  21  
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS