Ruby on Rails

What is Ruby on Rails?

This tutorial assumes beginner knowledge of HTMLCSS, and JavaScript.

"Ruby on Rails is an open source framework that's optimized for programmer happiness and sustainable productivity. It let's you write beautiful code by favoring convention over configuration" - rubyonrails.org

Ruby on Rails takes the role of languages like PHP and ASP.NET MVC to provide a framework that allows web programmers to write servers that host their websites. Rails powers mainstream high traffic web applications like Twitter, Twitch.tv, GitHub, GroupOn, Hulu, PennyArcade.com, Basecamp, and plenty more.

Tools

In order to walk through the curriculum you will need to setup some tools on your computer. These tools are free.

Rails Installer - Runs on Mac OS X and Windows 
Simple step by step installer with everything needed for Rails development.

Komodo Edit - Runs on Mac OS X, Windows, Linux 
Allows us to write code much more efficiently by highlighting the syntax we will discuss throughout the curriculum.

Chrome - Runs on Mac OS X, Windows, Linux 
Modern web browser that will allow us to preview and debug our content

Tutorial

This tutorial was created by rubyonrails.org the official website of the Rails framework. This ensures the material stays up to date and is as accurate as possible. It is designed to be read through step by step.

Guide Assumptions
Brief outline of the assumptions made by the guide.

What is Rails?
Explanation of principles behind rails. Skim lightly and refer back to this throughout the guide to understand the terms and theory behind each step.

Creating a new rails project
Creating the file structure, using rails generators, to store and run our Ruby on Rails code.

Hello, Rails!
Displaying text with rails on a web page by generating a controller, modifying a view, and running the rails project.

Getting Up and Running Quickly with Scaffolding and Creating a Resource
Guide to making the best of scaffold code generators and an introduction into RESTful resources by generating blog resources.

Adding a Second Model
Adding comments to our blog by generating a comments model and working closely with controller routing.

Refactoring
Simplifying and consolidating our views by utilizing view partials.

Deleting Comments
Using ActiveRecord to manage our database using native ruby objects

Building a Multi Model Form
Creating a Tag model to allow our posts to be tagged and using the form builder with multiple models.

Security
Securing sections of our blog from the public with the built in http_basic_authenticate_with function.

View Helpers
Creating helper functions to consolidate and clean up code used in views.

Configuration Gotchas
Catching some of the common encoding errors when developing with Rails.

Frequently Asked Questions

These questions are meant help you solve specific but common problems that may pop up when using this language. They are meant to be read after you have gone through the tutorial and begin actual development.

How can I put my Ruby on Rails application on the web?

There are numerous options for hosting Ruby on Rails applications due to it's recent boon in popularity and usage. Below are what this author thinks are some of the best hosts.

If you are a University of Washington student, staff, or faculty you can follow the UW IT Connect tutorial for setting up your Ruby on Rails application for free on UW servers.

If you want a free, easy to use, but very limited host than you can try using Heroku. They also have a step by step tutorial for uploading Ruby on Rails applications. You can pay to host with them for premium features, but that can get rather expensive.

If you want a paid host that has high performance and scalability, but requires extensive knowledge of virtual servers than you can try using Amazon EC2. A great resource for this is ec2onrails, but even this tutorial requires extensive knowledge of rails. Not recommended for beginners. 

Why use Rails over other widely used server side technologies such as PHP?

Rails favors a "convention over configuration" approach to software development meaning that you are forced to structure and do certain programming tasks following a single Rails convention as opposed to deciding project by project. This principle enforces best practices in software engineering even for beginners as opposed to languages like PHP which allow beginners to fall into preventable programming pitfalls. If you are interested in more reasons why check out the following link.

Supplementary Resources

In no particular order these external resources supplement the tutorial by providing shortcuts to commonly used information and further learning.

Ruby on Rails Guides - The rest of the Ruby on Rails guide we used for the tutorial section of this workshop. If you enjoyed the tutorial then go here for more of an in depth look at each part that makes up Ruby on Rails.

Rails for Zombies - Code School Tutorial - An alternative, but highly rated step by step tutorial for learning Ruby on Rails without any background experience. 

Last modified: December 19, 2013