Funky routing

map.connect ‘:controller/:action/:id’, :requirements => { :id =>
/^(.html)/ }

The requirement is turning all of my routes into /foo?id=54354 instead
of /foo/54354

Why?

Guest wrote:

map.connect ‘:controller/:action/:id’, :requirements => { :id =>
/^(.html)/ }

The requirement is turning all of my routes into /foo?id=54354 instead
of /foo/54354

Why?

I can only ask that you ignore the regex dealing with .html because of
the business requirements.

On Thu Jun 22, 2006 at 07:49:18AM +0200, Guest wrote:

map.connect ‘:controller/:action/:id’, :requirements => { :id =>
/^(.html)/ }

The requirement is turning all of my routes into /foo?id=54354 instead
of /foo/54354

ive noticed similar stuff. are you using SVN? i m prett sure some things
subtly changed. but i need to do an SVN up and see if it goes awa, i
havent updated for a few weeks. basically everything works fine on a
production server with apache, but here, things are totally screwed, i
get a lot of that ?id= crap…

I’m still running 1.1.2, so this shouldn’t be affected by what Jamis is
working on.

routes are behaving much different (eg broken) for me lately (r4484).
but maybe theres a better way to to short_urls anyways. this is my wild
guess, which worked fine with 1.1.2, but is unfortunately not
consoldated to routes.rb:

routes_
map.entity ‘entity/:id’, :controller => ‘entity’, :action => ‘show’,
:requirements => { :id=> /\d+/ }
map.entity ‘*shorturl’,:controller => ‘entity’, :action => ‘show’

helper
module EntityHelper
def u(e)
e.short_url ? entity_url(:shorturl => e.short_url) : entity_url(:id
=> e.id)
end
end

ctrlr
@e = Entity.find(params[:id]) if params[:id]
@e = Entity.find_by_short_url(params[:shorturl]) if params[:shorturl]

in the meantime, ive gone back to the revision in use on the server…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs