Forum: Ruby on Rails pretty urls with to_param and rails sweepers problem

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ingo W. (Guest)
on 2007-04-14 09:44
Hi all,

as seems to be quite common, I am overriding to_param for some of my
models to get nicer urls. For example:

countries/us/regions/ri

instead of

countries/15/regions/96

I understand the argument in favor of numeric ids, but in this case I am
using ISO standard codes so I figured that should be OK even for the
most puristic of purists.

It worked just fine for quite a while until I started using sweepers to
clear my page cashes. Turns out that in contrast to url_for, the sweeper
constructs urls using the standard numeric ids instead of my custom
ones, and hence fails to expire the pages correctly.

Is it possible to work around that somehow?

Ingo
This topic is locked and can not be replied to.