Route requirements lose RegExp options

I've just noticed that the :requirements option on a route doesn't
like Regexp options.

for example

map.vat_validity "#{active_vat_url}/:country_code/:vat_number",
    :controller => 'vat_numbers', :action => 'show',
    :requirements => {
      :country_code => /#{valid_eu_country}/i

completely ignores the 'ignore case' option at the end of the Regexp.

I've traced the problem to the way the Regexp is recast in
'generation_requirements' in the routing.rb. Essentially the options
from the original regexp are not being passed to when it is
recast. It looks like a simple patch.

However with routing being a complex beast I was wondering if somebody
with better knowledge of the routing code than I could let me know if
this is by design or whether it is the oversight it looks like.


I can't see why it would be deliberate, and if there's a way for you
to generate that same behaviour of adding \A and \Z then do prepare a
patch for it.

Patch created: