Programming language Ruby is a great language to learn, even if it’s a little lower in profile than Swift or JavaScript. Ruby, and its counterpart Ruby on Rails are widely used to create interactive websites. Indeed, Ruby is behind some of the biggest sites around. Read on to find out how to learn Ruby on Rails for your website.
Ruby on Rails was used to create big-name sites like Twitter, Groupon, GitHub, SoundCloud, and AirBnB. So you’ll be in good company if you learn Ruby.
You might also like: Learn how to code in Java on a Mac How to set up and learn Python coding on a Mac
Learn Ruby on Rails in OS X: What is Ruby vs. ruby on Rails?
First of all, let’s just clear up Ruby vs. Ruby on Rails. They’re two related, but different things:
Ruby is a programming language developed in the mid-1990s by Yukihiro “Matz” Matsumoto in Japan. It’s a modern object orientated programming language with dynamic type and automatic memory management.
Rails (aka “Ruby on Rails”) is a framework written in the Ruby language. It is designed to make programming web applications easier by making assumptions about what you want to do. You create web applications in the Ruby language, using a specific set of patterns. It’s a guided language, and it’s a lot easier if you learn the patterns it
We’ve already mentioned the pretty solid list of great websites built using Ruby on Rails, but it’s the ethos behind Ruby that makes it a darling of developers. Matsumoto designed Ruby for productivity and fun, a word not used often enough in programming. He says: “I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language.”
Matsumoto stresses that systems design needs to emphasize human, rather than computer, needs. So Ruby isn’t just a powerful language, it’s also a pretty fun one to learn too. Especially when you start to use Ruby on Rails to build interactive websites.
Learn Ruby: Setting up Ruby on Rails in OS X
The good news is that Ruby comes installed in OS X, so you’ve already got it. You are good to start learning Ruby right off the bat, although you’ll need a good text editor to create your code: Sublime (free trial) or Text Wrangler (free) are both great options, but any good text editor will do. Stay away from TextEdit, or a word processor like Word because they don’t save files in text format.
If you are a complete newcomer to Ruby, then it’s probably best not to worry too much about Rails for now. You’ll need a thorough grounding in Ruby before moving ahead to Rails. Move ahead to the “Learn Ruby on Rails in OS X: the best courses.”
If you want Rails set up alongside Ruby, then follow these steps:
- Open Terminal and enter ruby –version. You should see “ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin1”.
- Check that you have sqlite3 installed. Enter sqlite3 –version. You should see “3.8.10.2” followed by the installation date and hash code.
- Now enter sudo gem install rails. Gem is a package installer that comes with Ruby. It can take a while for Rails to be installed on your system (it took around half an hour on our test system), so let the Terminal window do its thing uninterrupted. In the end, you should see “33 gems installed”.
- Enter rails –version to ensure that it’s been setup correctly. You should see “Rails 4.2.6” (or later).
Learn Ruby: The best courses
Now that you’ve checked Ruby and installed Rails, it’s a good idea to see what you can do with them.
There are hundreds of great Ruby and Ruby on Rails courses. Here are just a few to get started with:
- Udemy: Complete Ruby on Rails developer course.
- TeamTreeHouse: Learn Ruby. This interactive course takes you from a complete newcomer to expert.
- Learn Ruby the Hard Way. The “Hard Way” courses are an acquired taste, but they really do give you a thorough grounding in programming.
- Codecademy: Learn Ruby on Rails. Codecademy remains one of the best interactive courses around. Free too.
- Lynda: Ruby training tutorials. Lynda has a fantastic selection of video tutorials that get you up and running in Ruby.
Please let us know of any other courses you found helpful in the comments.