Route generation problems

Charlie Hubbard
Mon, 30 Oct 2006 14:42:40 -0000

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/.