The 2.3.0 release breaks resolving of old slugs when using a cache key. This problem also exists in the 2.3.1 release. First of all: thank you for using the cached_slug value in the standard find, it gives a nice performance improvement. On the downside: the change breaks looking up of old slugs from the table.
>> m = Model.find('lorem-ipsum')
=> #<Model id: 903, name: "Lorem ipsum", cached_slug: 'lorem-ipsum'>
>> m.name = "dolor sit amet"
=> "dolor sit amet"
>> m.save
=> true
>> m.cached_slug
=> "dolor-sit-amet"
>> m = Model.find('lorem-ipsum')
ActiveRecord::RecordNotFound: ActiveRecord::RecordNotFound
>> m = Model.find('dolor-sit-amet')
=> #<Model id: 903, name: "dolor sit amet", cached_slug: "dolor-sit-amet">
>> m.slugs
=> [#<Slug id: 1365, name: "dolor-sit-amet", sluggable_id: 903, sequence: 1, sluggable_type: "Model", scope: nil, created_at: "2010-02-11 07:18:24">, #<Slug id: 144, name: "lorem-ipsum", sluggable_id: 903, sequence: 1, sluggable_type: "Model", scope: nil, created_at: "2009-12-09 08:36:15">]
There are Slug records for both slugs, but the table is never used for finding because there is a cached_slug column on that specific model.
Is it possible to do a (optional) second find query in the model when a search using the cached_slug throws a ActiveRecord::RecordNotFound
exception?