url in route snippets

Allowing URL's in a route.

Tagged rails routes, url in route  Languages ruby

I wanted to create a route that could accept an URL as a parameter. The problem was that dots and slashes were interpreted as separators for the route. Luckily I managed to find this post that explained how it could be bypassed.

map.connect ':scale/:text.:format', :controller => 'barcode', :requirements => { :text => /.*/ }

With this route set up I now could catch parameters like this: http://localhost:3000/200x200/http://aktagon.com.png, where 200x200 is :scale, http://aktagon.com is :text and .png is :format.