Skip Navigation

Find cheat sheets for every topic, or make your own to share with your friends.

All Added Bytes cheat sheets are available free at Cheatography!

Visit Cheatography »

Ruby on Rails Cheat Sheet

A quick reference guide for Ruby on Rails, containing the default directory structure, predefined variables, methods, reserved words and regular expression syntax.

The Ruby On Rails cheat sheet is designed to be printed on an A4 sheet of paper and live by a developers desk, to make life a bit easier. A description of what is on the cheat sheet follows, or if you are impatient, you can go straight to the full size Ruby On Rails cheat sheet.

I am no expert in Ruby, On Rails or off, so to ensure this cheat sheet was as useful as possible, I pestered the very helpful Amy Hoy of (24)Slash7 and David Heinemeier Hansson of Loud Thinking into giving me a hand. Thanks, both of you - I appreciate it. In the same vein, though the cheat sheet has been checked there is a chance there is the occasional typo - if anybody spots a mistake (or something that could be worded better) please let me know.

Default Directory Structure

Thumbnail highlighting default directory structure. Ruby on Rails by default uses a rather large selection of folders and files, organised into a directory structure. This is a great feature, but does occasionally lead to people getting slightly lost and forgetting where to find something, especially if what they are looking for is something they use infrequently. This section shows visually the default directory structure of a Ruby on Rails site.

Pre-Defined Variables

Thumbnail highlighting pre-defined variables list. Ruby on Rails, like most languages, includes a large number of predefined variables. These shorthand variable names are often tricky to dig out from the back of the mind when actually needed, so here is a convenient list of the most useful of them.

Reserved Words

Thumbnail highlighting reserved words. In much the same way as Pre-defined variables, Ruby on Rails makes use of reserved words and these are also often not easy to remember. Using them out of context can cause all sorts of problems, so this list is provided to ensure that doesn't happen. Ignore it at your peril!

Regular Expression Syntax

Thumbnail highlighting regular expression syntax. It seems that no matter the language, most developers always spend some time stumbling through regular expressions before they are comfortable with them. Ruby on Rails is no different, and the regular expression syntax is the same familiar syntax as used in PHP and Perl. This section outlines the building blocks of patterns in regular expressions for Ruby on Rails.

Methods

Thumbnail highlighting methods section. Ruby on Rails is very much an object oriented language. Every object has methods. These sections list the useful methods for working with String, Array, Time and Regex objects. It also lists validation methods and methods from the enumerables mixin - which are some of the most looked-up.

Download

So now that you know what it does, please feel free to print out the Ruby on Rails cheat sheet:

And finally, if you like the cheat sheets, and want to say thanks, please consider buying me something from my Amazon Wishlist. Thankyou very much to those who have already hunted it down and sent me something nice - I'm very grateful!

Please note: If you wish to link to the Ruby on Rails cheat sheet from elsewhere, please link to this page so others find the description, rather than linking directly to the sheet.

Related Cheat Sheets

Python

Python Cheat Sheet

The Python Cheat Sheet, a quick reference guide for the Python programming language.

Regular Expressions (V2)

Regular Expressions Cheat Sheet (V2)

The second version of the Regular Expressions Cheat Sheet, a quick reference guide for regular expressions, including symbols, ranges, grouping, assertions and some sample patterns to get you started.


comments powered by Disqus