Appendix A. An Incredibly Brief Introduction to Ruby

Fortunately, you don’t need to know a whole lot of Ruby to get real work done with Rails. The creators of Rails have used many of Ruby’s most advanced features to make Rails easy to work with, but fortunately you can enjoy the benefits without having to know the details. This appendix explains the basics you’ll need to perform typical tasks in Rails and should help you get started. For a lot more detail on Ruby, try Learning Ruby (O’Reilly, 2007), The Ruby Programming Language (O’Reilly, 2008), The Well-Grounded Rubyist (Manning, 2009), or Programming Ruby (Pragmatic Programmers, 2009).

Note

If you’ve never worked with a programming language before, this appendix may go too fast for you. It’s hard to be incredibly brief and cover the basics at the same time. However, if you’ve worked with JavaScript before, you should be able to get started here.

Ruby is a beautiful but sometimes mystifying language, and probably a better choice as a second language to learn rather than a first language.

Because this is a Rails book, examples will work inside of the Rails framework, in a Rails view and controller, rather than from the command line. If you haven’t touched Rails before, it makes sense to read Chapter 1 first and get Rails installed, and then come back here for more instruction.

How Ruby Works

Ruby is an object-oriented language. Although it’s often compared to Perl, because Ruby code often looks like Perl, Ruby’s ...

Get Learning Rails 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.