Rails meets Sinatra on Heroku

I have a Sinatra app. But, I need Devise for authenication. So, I searched around and found Pratik post:

    http://m.onkey.org/rails-meets-sinatra

I started with it, but without real understanding of what "thin" and "rack" is. I stumbled a bit before I got it right.

Heroku has already run with "thin" middleware (it is true at least for pre-Cedar), so some lines from Pratik's post is not necessary.

Fortunately, after all figured out, it is even simpler.

Consider that the rails app is generated with the following line:


    rails create MyApp

Here are various files you needed:

To start it locally:


    thin start

In the hindsight, once I understood what rack really is, it is pretty simple. The Ruby Rack architecture already support this natively.