Hi, I have an outstanding problem with route generation. Right now if I generate a route with the following syntax. url_for( :controller => "foo", :action => "bar", :id => 4 ) I get /foo/bar/4 I always get a URL without a trailing slash on the end. I want to add a trailing slash always after the ID parameter. I have generated HTML content that I want to always append to the root URL like above. And I keep getting bad URLS. I also have another problem when doing route generation where: url_for( :controller => "foo", :action => "bar", :id => 4, :page => 5 ) returns: /foo/bar/4?page=5 Eventhough my route configuration is: map.connect "foo/bar/:id/:page", :controller => "Foo", :action => "bar", :requirements => { :id => /\d+/, :page => /(\d+)|(\w+\.html)/ } This rule is never used when generating routes, and it''s really important because of the problem I showed above. Any help please? Charlie -- 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 -~----------~----~----~----~------~----~------~--~---
Charlie Hubbard wrote:> Hi, > > I have an outstanding problem with route generation. Right now if I > generate a route with the following syntax. > > url_for( :controller => "foo", :action => "bar", :id => 4 ) > > I get > > /foo/bar/4 > > I always get a URL without a trailing slash on the end. I want to add a > trailing slash always after the ID parameter. I have generated HTML > content that I want to always append to the root URL like above. And I > keep getting bad URLS. I also have another problem when doing route > generation where: > > url_for( :controller => "foo", :action => "bar", :id => 4, :page => 5 ) > > returns: > > /foo/bar/4?page=5 > > Eventhough my route configuration is: > > map.connect "foo/bar/:id/:page", > :controller => "Foo", > :action => "bar", > :requirements => { :id => /\d+/, > :page => /(\d+)|(\w+\.html)/ } > > This rule is never used when generating routes, and it''s really > important because of the problem I showed above. > > Any help please? > > Charlie > >Hey C, I guess you already tried the following, but just in case: map.connect "foo/bar/:id/:page", :controller => "foo", :action => "bar", :requirements => { :id => /\d+/, :page => /(\d+)|(\w+\.html)/ } # I''ve never had explicit x.html # requests routed to rails though # so I''ve no idea if it''ll work map.connect ":controller/:action/:id/" map.connect ":controller/:action/:id" # should solve the trailing slash issue Gustav Paul gustav-PUm+PnBUKx7YkQIYctQFYw@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Charlie Hubbard wrote:> Hi, > > I have an outstanding problem with route generation. Right now if I > generate a route with the following syntax. > > url_for( :controller => "foo", :action => "bar", :id => 4 ) > > I get > > /foo/bar/4 > > I always get a URL without a trailing slash on the end. I want to add a > trailing slash always after the ID parameter. I have generated HTML > content that I want to always append to the root URL like above. And I > keep getting bad URLS. I also have another problem when doing route > generation where:Well I found the answer to the first question after piling through the source. There is a :trailing_slash option you can add to your url_for or link_to to get the trailing slash. Still don''t have an answer for the second question. I guess it''s back to the source.> url_for( :controller => "foo", :action => "bar", :id => 4, :page => 5 ) > > returns: > > /foo/bar/4?page=5 > > Eventhough my route configuration is: > > map.connect "foo/bar/:id/:page", > :controller => "Foo", > :action => "bar", > :requirements => { :id => /\d+/, > :page => /(\d+)|(\w+\.html)/ } > > This rule is never used when generating routes, and it''s really > important because of the problem I showed above. > > Any help please? > > Charlie-- 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 -~----------~----~----~----~------~----~------~--~---