How to show by id?

Hello there,

I have a small question how to get id from this URL?

http://domain.com/blog/subjectio+awd+2

This route doesn’t seems to work as I want it?

map.connect ‘blog/:name-:id’,
:controller => “blog”,
:action => “list_by_id”,
:requirements => {:name => /\w+/, :id => /\d+/}}

Hope someone can give me a push :smiley:

Regards,
Jamal

On Thu, May 24, 2007 at 11:51:57AM +0200, Jamal S. wrote:

Hope someone can give me a push :smiley:

I don’t see any dashes (-) in the URL you posted. Additionally your
requirement of \w+ will not match the plus.

You could take a look at some of the slug plugins available for
inspiration:

http://agilewebdevelopment.com/plugins/search?search=slug


Cheers,

  • Jacob A.

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