Opinions on catch-all routing?

I remember reading somewhere a tip on improving your search engine
ranking, by forming URLs that included relevant text, e.g.
www.domain.com/article/man_eats_hat. In the rails app that I’m writing,
I’ve noticed I can set this up very easily by appending the post title
(after downcase.split.join(‘_’)) to the post link. So, Sooma
can easily also be Sooma, with the following
added to config/routes.rb:

map.connect ‘:controller/:action/:id/*anything’

Of course this also means that Sooma points to
the same place, and I was wondering if this could be considered as bad
practice.

Any thoughts?

map.connect ‘:controller/:action/:id/*anything’

Of course this also means that blog.com/posts/4/anything_else points to
the same place, and I was wondering if this could be considered as bad
practice.
You could just have a url version of your blog title in the db. You can
then just have your urls like this:
/posts/my_blog_title/ rather than including the id.

I’ve written a plugin called ‘url_column’ that will maintain a url in
the table from a specified column automatically on saves and updates.

For example, you can do:

class Post < ActiveRecord::Base
url_column :post_url, :from => :title
end

Whenever you save or create a post it’ll automatically ‘urlify’ the post
title and update the post_url column.

If you’re interested, i’ll post it up somewhere.

Hope that helps!

Steve

On 6/9/06, Stephen B. [email protected] wrote:

the table from a specified column automatically on saves and updates.
If you’re interested, i’ll post it up somewhere.

Hope that helps!

Please post it. That sounds interesting.

On 6/19/06, Stephen B. [email protected] wrote:

This is a very ‘new’ plugin so do have a play and let me know the
results.

Oh and if it’s deemed worthy, i’d like to find a nicer place for it to
live - my blog is not really a great advert for a ‘nice url’ plugin.

Very cool. Thanks for sharing this.

Hi Stephen,

Very nice. My only suggestion would be to call it
permalink_column instead of url_column.

Brent

— Stephen B. [email protected] wrote:

Hey All,

I’ve just packaged up a small plugin i wrote to
manage nice urls from a
model attribute.

It’s available for download here:

http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23

nicer place for it to
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around

Hey All,

I’ve just packaged up a small plugin i wrote to manage nice urls from a
model attribute.

It’s available for download here:
http://www.2404.co.uk/index.php?path=articles/view.php&articleId=23

I can only apologise in advance for my dodgy blog - don’t let the
horrible url and php scare you off :0)

This is a very ‘new’ plugin so do have a play and let me know the
results.

Oh and if it’s deemed worthy, i’d like to find a nicer place for it to
live - my blog is not really a great advert for a ‘nice url’ plugin.

Cheers!

Steve

Very nice. My only suggestion would be to call it
permalink_column instead of url_column.
Hmm… good sugguestion - but it’s not really specifically for permenant
links. It’ll will be updated if, say, the title of the page changes.

In that respect it can be used for categories, pages, products -
whatever.

Steve

On Jun 19, 2006, at 16:37, Stephen B. wrote:

horrible url and php scare you off :0)

This is a very ‘new’ plugin so do have a play and let me know the
results.

Oh and if it’s deemed worthy, i’d like to find a nicer place for it to
live - my blog is not really a great advert for a ‘nice url’ plugin.

Nice! Does it handle non-ASCII in UTF-8?

– fxn

Posted at http://agilewebdevelopment.com/plugins/url_column :slight_smile:


Benjamin C.
http://www.bencurtis.com/
http://www.tesly.com/ – Collaborative test case management
http://www.agilewebdevelopment.com/ – Resources for the Rails community

Nice! Does it handle non-ASCII in UTF-8?
It uses basic Ruby replaces. I’ve not really tried it with anything
more complex than the examples and tests - try it out and let me know
:0)

Steve