One of the biggest frustrations beginners have with learning Rails is getting their head around all the 'magic' that Rails seems to do.
The power of Rails is how quickly you can develop complex apps, this speed comes from all the things Rails does for you in the background. Rails does a lot of complex things in the background that are hidden with abstractions. This is where the perceived 'magic' happens.
Sinatra is a small light weight web framework written in Ruby. It allows you to make small web applications quickly. Like Rails, Sinatra is built upon Rack so you can think of it as a bare bones version of Rails. There is no 'magic' to speak of as everything is very explicit. This is why learning Sinatra before learning Rails is so beneficial. It reduces the learning curve of learning Rails quite a lot.
Sinatra does a few of the same things that Rails does, but it doesn't create the file-structure for you. The benefit of doing it yourself (and the main reason we're learning this at all) is that once you get a feel for how to set up routes and organize your views in Sinatra, the complex file structures and methods in Rails will start to make a whole lot more sense.
There isn't a whole lot to Sinatra so you can learn it pretty quickly, but as you will see you can build very impressive apps with it.
Look through these now and then use them to test yourself after doing the assignment
Go to the Sinatra website and follow the (somewhat cryptic) instructions right on their front page:
hi.rbwith the following code:
require 'sinatra' get '/hi' do "Hello World!" end
gem install sinatrathen run the file you created:
Work through this tutorial from Jumpstart Labs. Be sure to try out some of the Extensions at the end of the tutorial, that's the fun stuff!
Take a look at the Sinatra README and read through the first eight sections of it ( until section 8, "Helpers").Almost everything you will need to know about Sinatra is right here on this page so use it as a reference when you are working through the project.
This section contains helpful links to other content. It isn't required, so consider it supplemental for if you need to dive deeper into something
From the creators of The Odin Project...