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 Regexp.new 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.
NeilW
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-core-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---
On Thu, Mar 20, 2008 at 1:39 AM, Neil Wilson <aldursys@gmail.com> wrote:> > 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 Regexp.new 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. -- Cheers Koz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 23, 11:40 pm, "Michael Koziarski" <mich...@koziarski.com> wrote:> 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. > > -- > Cheers > > KozPatch created: http://dev.rubyonrails.org/ticket/11421 NeilW --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---