chaplinjs/chaplin — pull request #727 by Sija (2013-12-06 23:07:16+00:00)
Title: Fix matching routes with trailing slash (refs #532)

Hi,

It's an attempt to fix non-functioning routes when using trailing slash. I stumbled upon it while testing my app with urls like http://app-domain.dev/recipes vs http://app-domain.dev/recipes/, where in the latter case Chaplin doesn't recognise my routes anymore.

My `routes.js.coffee`:
```coffeescript
define ->
'use strict'

# The routes for the application. This module returns a function.
# `match` is match method of the Router
(match) ->

match '', 'welcome#index', name: 'root'

match 'signin', 'session#login', name: 'signin'
match 'signup', 'session#register', name: 'signup'

match 'search', 'search#index', name: 'search'

match 'recipes', 'recipes#index', name: 'recipes'
match 'recipes/new', 'recipes#new', name: 'new_recipe'
match 'recipes/:id', 'recipes#show', name: 'recipe'
match 'recipes/:id/edit', 'recipes#edit', name: 'edit_recipe'

match 'ingredients', 'ingredients#index', name: 'ingredients'
match 'ingredients/:id', 'ingredients#show', name: 'ingredient'

match 'users/:username', 'users#show', name: 'user'
match 'users/:username/recipes', 'recipes#index', name: 'user_recipes'
```