Daniel Doubrovkine bio photo

Daniel Doubrovkine

aka dB., @awscloud, former CTO @artsy, +@vestris, NYC

Email Twitter LinkedIn Github Strava
Creative Commons License

… slow migrations … slug …, get it?

We have been using mongoid_slug at Art.sy for a very long time. The basic idea of the gem is to introduce a friendly URL based on document’s data. For example, artworks can be found at addresses such as https://www.artsy.net/artwork/jeremy-geddes-pale-memory-4. This morning, I wrote a blog post on our implementation details, including history and internationalization.

The gem’s most recent 2.x iteration is a significant improvement over the previous releases and enables slug history that can be used for lookups. That took some courageous refactoring from the authors – and it only supports Mongoid 3.x. Upgrading all gems to Mongoid 3 and having to migrate mountains of data was a lot for us to swallow a the same time, so I forked an older version of mongoid-slug and added Mongoid 3.x support that writes both the old slug and the new _slugs values. The fork is now community-supported at https://github.com/dblock/mongoid-slug/tree/v0.10.0-mongoid3-with-slugs along with tested instructions for how to perform a slow migration from mongoid-slug 0.10.x to 2.x without any downtime.

Happy Thanksgiving!