Wednesday, December 9, 2009

Getting Started with Rails

I was asked today what resources I would recommend for getting started with Rails.

Firstly, learn some Ruby. Ruby is a very deep language with a lot of really cool stuff you can do to get the most out of it. You can really make a choice here between learning a lot of Ruby straight away or just learning enough that you can start tinkering in rails. You could easily create an entire Rails application without touching any of the metaprogramming tricks or fancy shortcuts that Ruby provides, it is way cooler if you do use them though.

There are, of course, docs pages for both Ruby and available for day to day use but they're not exactly learning tools. So I'll take the time to describe some of the more explanatory resources available.

Learning Ruby

A good first look is Ruby in 20 minutes.

After that you can try and dive into rails and rely on docs or, if you want a lot more depth in your exposure to ruby, then Programming Ruby by the Pragmatic Programmers(affectionately known as the pickaxe due to its cover) is a very good bet. It has nearly everything you'll ever need to know and is a good read.

Learning Rails

The Pragmatic Programmers also publish what is essentially the definitive introduction to Rails. Agile Web Development With Rails is now in its third edition and reading it cover to cover would not be time wasted.

A second, and free, resource for rails developers are the Rails Guides a collection of detailed guides to most of the major parts of Rails. They're maintained well, although often checking the "edge" version of the guides is necessary to find ones that are currently in draft state. If you can't get your hands on the book, then the guides are probably the best replacement.

The other major area to pick up on before calling yourself a Rails developer is testing. The tradition in the Ruby and Rails community is to test as much as possible. While Rails comes with test::unit, a test framework called Rspec has become the dominant framework in community and is worth taking the time to learn sooner rather than later if you intend to stick with Rails, the website has reasonably easy to follow introductory guides. Cucumber is another testing system that is often used in conjunction with Rspec to create a wider range of tests, you can afford to leave it out for longer though although it is worth learning about(and using) eventually.

Broadening and Maintaining Your Skills

A number of very good alternative resources have sprung up for rails, one of the best is Railscasts. Which, at the time of writing, has nearly 200 detailed videos available for free regarding a variety of Rails related topics. If you're having trouble with a particular aspect of rails then check if there is a video available on Railscasts.

Peepcode do some very nice longer Rails videos on important topics and are well worth a look, although they charge for the videos so it's worth having a clear idea of what you want to know about.

Ruby5 is a convenient podcast for keeping up with Ruby and Rails related news. Although, it's often easier just to check the topics listed on the website rather than spend the time listening to the podcast itself.

IRC channels can mostly be found on freenode with #rubyonrails having a significant pool of people who alternate between happy and grumpy at an exciting pace. #railsbrain also features good people and is likely to be friendlier to newcomers.

There is also a significant pile of blogs related to Rails floating around they're generally pretty easy to find and the best posts will generally float to the surface. At the same time it's good to be cautious of any blog posts that Google finds you as Rails has moved a lot in the last few years and many of the blog posts it finds are no longer relevant.

Hopefully these resources can put you on your way to being a Rails developer.