Chapter 4

Rails-Flavored Ruby

Grounded in examples from Chapter 3, this chapter explores some elements of the Ruby programming language that are important for Rails. Ruby is a big language, but fortunately the subset needed to be productive as a Rails developer is relatively small. It also differs somewhat from the usual material covered in an introduction to Ruby. This chapter is designed to give you a solid foundation in Rails-flavored Ruby, whether or not you have prior experience in the language. It covers a lot of material, and it’s OK not to get it all on the first pass. We’ll refer back to it frequently in future chapters.1

1. For a more systematic introduction to Ruby, see Learn Enough Ruby to Be Dangerous (

Get Ruby on Rails Tutorial, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.