On Rails, Sinatra, and picking the right tool for the job. Pedro Belo, of Heroku fame, finds Rails is way better for pure-web apps and Sinatra is way better for pure-API apps. Most of it comes down to Rails has better tooling and Sinatra is better for scratching itches, which happens a lot more in APIs than applications. I’m not ready to pronounce this the final word, but what he’s saying lines up with much of my experience.
That said, you can get pretty far with a Rails API by segregating it from your application. That is, your app controllers inherit from ApplicationController
and your API controllers inherit from ApiController
. This keeps the often wildly different needs of applications and APIs nice and distinct.