Getting started with Ruby on Rails

 Date: July 10, 2013

Ruby on Rails logo

Recently I decided to learn Ruby on Rails. When you start learning a new technology you are always looking for the best available materials (to learn as efficient as possible). I did the same (using Google and StackOverflow). Fortunately I found The Best Way to Learn Ruby on Rails and I followed the recommended steps. With small modifications (extensions).

First of all I extended first step. Instead of just going through "Try Ruby" exercises I also read first chapter of Seven Languages in Seven Weeks (which is about Ruby). It was very good move, because this book is written in the way to show the flavors of language by comparison with others. I am a .NET guy, who was coding in PHP, C++, Java and Python before. Because of that I was more interested in the differences between Ruby and these languages, than in programming from ground up. I also reviewed (not read) Humble Little Ruby Book. It is a little bit more deep, but it gives you solid Ruby basics.

I was working with Rails on Windows and on Mac. Installing on Windows is very easy when you use RubyInstaller. There is also version for Mac. However on Mac you can also install Rails using RVM. In that case I recommend you installation screncast by Michael Hartl. On Windows I used RubyInstaller, but on Mac I took advantage of Michael Hartl's screencast. Additionally you may also need SQLite Database Browser to browse your database easily. I did not know about it at the beginning and I was using rails dbconsole. Browsing with SQLite Database Browser is much more comfortable!

When I had Rails installed I went through Jeffrey’s Introduction to Rails. During that I tried to follow him, by writing code on my machine, but many times he was too fast. I needed to pausing video very often and even scrolling back to see written command (he was changing screens to quickly). Anyway it was very nice introduction and I recommend it. But you can skip rewriting and trying code he is writing. Just watch it to get a flavor of Rails.

After that I went through Rails for Zombies tutorials. I was very lucky, because Code School had promotion in May 18-19, and they provided Rails for Zombies 2 for free in these days. These tutorials are very solid. The exercises force you to learn by typing, because you cannot proceed to next level, until you do not finish all tasks.

Agile Web Development with Rails cover

With all basics gained as described above I started a book: Agile Web Development with Rails. I really like this book. It has 3 parts:

  • Getting started (Rails installation, create first app, quick Rails architecture overview)
  • Building application (tutorial)
  • Rails in Depth

The longest part of the book is the tutorial(2nd). Through this part you are creating an complete application exploring different Rails features. Unfortunately this book is a little bit outdated. Authors use ruby version 1.8.7 and Rails 3.0.0. I installed most recent versions: ruby 1.9.3p392 and Rails 3.2.13. Sometimes you need to fix the code (e.g. Chapter 11 - Task F: Add a Dash of Ajax). During that I found Ruby on Rails documentation very useful.

The last part is going deep into Rails. I really recommend this part! It is not only about Rails, but also about Web Applications and MVC architecture in general: how browser works, how requests are handled by Rails app, session, cookies etc.

When I was in the middle of book I was a little bit angry (because it is outdated) and I switched to Ruby on Rails tutorial by Michael Hartl, which is strongly recommended on StackOverflow. Well...guys at SO are right. This is really good piece of knowledge not only about Rails, but also about using git, css, Bootstrap and Web Development in general. I really enjoyed it! If you do not want to buy videos, you can just read the free book (it is the same content as in videos and more). There are also nice videos describing advanced setup for Rails development on Mac and SublimeText configuration for Rails. Actually this tutorial covers Rails development from A to Z.

As a summary to the book and Michael Hartl's tutorial I reviewed Rails Guides. It is a nice overview for most important rails features. Can be also used as a reference. Some of the RailsCasts are also useful.

I wanted to try a few different tutorials/books to see different approaches. E.g. Michael Hartl use rspec for unit tests, but the authors of Agile Web Development with Rails are using rails testing framework.

My adventure with Ruby (on Rails) lasts almost two months. Now I can admit that ROR is a very powerful and developer friendly framework. It contains many features, which are already grabbed by ASP.NET (e.g. migrations, bundling). What was surprising for me, you do not need IDE to develop Rails apps. I use SublimeText2 (awesome editor!) and it is really enough. Some Rails developers use VIM or Emacs. Of course there are some IDEs such as RubyMine or Aptana Studio. I tried both. RubyMine seems to be pretty cool...but I stick with SublimeText. Additionally, during Rails development you spend lot of time with console (to create/run/undo migrations, create models/controllers, run tests etc.).

If you want to start Rails development, my recommended steps are:

You might also find these tools/resources useful:

What I like in Ruby on Rails? The syntax, convention over configuration and lots of implemented features in the framework layer. Moreover: Rails are just cool.

 Tags:  books programming

Previous
⏪ Build 2013

Next
Sending email from Rails application ⏩