rmu/puzzlenode — pull request #61 by brentvatne (2011-12-08 21:15:36+00:00)
Title: Puzzle route from numeric database id to slug

In response to issue #58 - changed the route for puzzles from `/puzzles/id` to /puzzles/`slug`. The slugging engine is adapted from University Web `Slugger`. Note, however, that the actual params variable referenced for puzzles did not change from `id`.

What I mean by this is that to find a puzzle in the `PuzzlesController`, we now do `find_by_slug!(params[:id])` rather than `find(params[:id])` If anyone knows how to do this without adding a lot of complexity to the nested `puzzle/slug/comment` and `puzzle/slug/submission` routes, that might be desirable. Thoughts?

I was also unsure how to properly test the JavaScript in the new puzzle form in `test/integration/admin/puzzles_test.rb` as the slug is generated via an ajax call to the SluggerController - instead I just filled in the slug value.

We should ask ourselves before we merge this to master: what should we do about the old routes? Should there be backwards compatibility so `/puzzles/1` correctly leads the user to `/puzzles/whatever-the-name-is-for-id-one`?