Soooo today at the Flatiron School, we learned some Rails of the first time. After practicing with Sinatra for a few weeks being introduced to Rails felt sort of odd. For example, the wind was knocked out of me when after installing rails I typed in the command line:
rails new my_first_rails_project
Boom! I had now all these folders in my_first_rails_project folder. So many that I was overwhelmed and perplexed.
Afterwards, I typed:
rails g scaffold some_resource
And BOOM! again. More files, everything I needed to get my application up and running just like that.
The reason for this is that Rails is a heavyweight Ruby framework, meaning that it comes with more files to run your Ruby application. Sinatra, on the other hand is a lightweight one. requiring much less files.
I can see that striking difference in how you write the responses for http requests in these frameworks. In Sinatra the controller and router are in the same file, often called app.rb whereas in Ruby these are in separate files conveniently names Controllers and Models.
Another difference I noticed is how one sets up the database. Sinatra requires you to do it manually. Rails comes with ActiveRecord and rake and as you may have imagined, you can type another terminal command and… BOOM!. All is set up for you.
So far playing with Rails feels like magic. Like saying abracadabra and something materializing out of thin air. I want to learn more about it and make sure I understand it inside out because at them moment I don’t really know what is going on under the hood.