This is something that ends up in the
app/lib directory of almost every Rails project that I manage. Credit goes to Adam Hawkins's original blog post on the topic, but the code here is slightly modified to be used as a singleton.
# => http://localhost:3000/posts
# => /posts