Hi you all, I have the following resource in my routes.rb query_pattern = Regexp.new(''(\w+[=]?\w*[/]?)*'') map.resources :queries, :path_prefix =>''/sdrs'', :name_prefix=>''sdrs_'', :requirements=> {:id =>query_pattern} To have and idea, my :id can be: key key=value key=value/key key=value/key=value... to the infinite and beyond... However, when routing, an appears ocurred: no route found to match "/sdrs/queries/puertoa=1030/portb" with {:method=>:get} I mean, there are problems with the "/", even though I read with :requirements the problems could be avoided... Suggestions? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/13/08, Damaris Fuentes <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi you all, > > I have the following resource in my routes.rb > > query_pattern = Regexp.new(''(\w+[=]?\w*[/]?)*'') > map.resources :queries, :path_prefix =>''/sdrs'', :name_prefix=>''sdrs_'', > :requirements=> {:id =>query_pattern} > > To have and idea, my :id can be: > key > key=value > key=value/key > key=value/key=value... to the infinite and beyond... > > However, when routing, an appears ocurred: > no route found to match "/sdrs/queries/puertoa=1030/portb" with > {:method=>:get} > > I mean, there are problems with the "/", even though I read with > :requirements the problems could be avoided... > > Suggestions?I think that in order to get open ended uri routing like that you need to use route globbing, (google for rails route glob). I''m not sure that map.resource and map.resources allow globbing, so you might need to build the equivalent route the old fashioned way. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yes, this is exactly what I was doing right now (someone told me in the Spanish Rails forum). Thanks all :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Uhm, however, I''m seeing a problem. My app has the REST approach with the respond_to method. So, when I type in the URL something like .../key/value.xml it takes the value as value.xml ( forgetting the XML). Everything works correctly from an HTTP client, such as curl, but not through the browser. Damaris Fuentes wrote:> Yes, this is exactly what I was doing right now (someone told me in the > Spanish Rails forum). > Thanks all :)-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---