There’s got to be a prettier way of implementing this.
We use the following code to render API documentation, which is written in Markdown.
Add a route that will capture the document filename in config/routes.rb. Bonus features: a namespaced controller and a redirect to /api/v1/docs for /api/v1.
Create a controllers/api/docs_controller.rb.
You can now create public/api/v1/docs/something.md and it will render under api/v1/docs/something.
What I’d like to do is take the Markdown renderer out of this controller, define it as a generic handler, and swap the template being rendered to the filename instead. How do I do that?