Im confused about Sinatra (the ruby framework).
Is it a lightweight Rails replacement or you can have them running side by side?
Can you do a web application (as in Rails)? For example a twitter clone?
Im confused about Sinatra (the ruby framework).
Is it a lightweight Rails replacement or you can have them running side by side?
Can you do a web application (as in Rails)? For example a twitter clone?
Take my answer with a bit of a grain of salt (because I haven't actually deployed a sinatra application before), but sinatra's "sweet spot" is micro-apps: tiny little applications where a full MVC framework would be overkill. With Sinatra, you can build an entire web app with a single file of code.
An example of a "micro app" is rubular (note, however, that I have no idea what framework it's written in). Rubular does one thing, and one thing very well. Using rails would be overkill.
Sinatra is not Rails. It is a micro-framework used for simple websites where you may need to just define a few actions. You can make a Sinatra application as complex as you want to, but you'll hit a point where you code has become a crazy mess sooner than with Rails.
While not 100% accurate, Sinatra fits mostly into the Page Controller architectural pattern, and Rails is a clear MVC implementation.
To answer your questions specifically:
We're currently using Sinatra for a production project (not deployed live yet, still in dev).
Basically it's wrapping around a database used by a legacy app, and exposing REST web services to other apps internally so they can interact with the legacy app without having to access the DB directly.
Rails was considered, but not used because:
Given these requirements Rails is usable, but overkill, where as Sinatra hits the spot nicely.
We used Sinatra for http://tweetarium.com much like madlep's usecase the majority of the site is just AJAX calls, so the views are very simple.
We don't use an ORM, just serializing the JSON from the twitter API and caching it in TokyoCabinet
I personally think Sinatra is an excellent fit for APIs. Each version could be a different Sinatra app mounted at a different endpoint and you can run it inside of your Rails app.