Rails 3 vs Sinatra

Jay Godse picture Jay Godse · Aug 29, 2010 · Viewed 10.2k times · Source

For my next web application, I'm debating whether to use Rails 3.x or Sinatra.

I would like to use the server to provide user authentication, application-triggered emails, a fairly complex data model (behind ActiveRecord), and a JSON data interface with the web client. The client side will use static HTML, static CSS, Javascript/jQuery to render the JSON data into the views. The "policy" for rendering views will be driven by the Javascript code and some of the JSON data. I do not plan to use any dynamic view technologies such as ERB, HAML, or RJS.

Would I be better off with Sinatra or Rails 3.x?

Are there any other questions I should ask before making that decision?

Answer

Antoine picture Antoine · Aug 30, 2010

Your data model is fairly complex, so I imagine your application will have to handle a significant number of business rules and interaction possibilities.

Sinatra is meant for handling lightweight software architectures. If you choose Sinatra you'll probably encounter design and organization issues you'll have to handle by yourself. Rails implements the MVC pattern and can help you organize your code by offering a lot of useful mechanisms.

You still can build a "full-stack" web app with Sinatra but you'll have to do a lot by yourself especially if the amount of functionality you'll provide is high (or will grow). I think Rails fits naturally better in larger architectures.

PS : ActiveRecord is available both in Sinatra and Rails.