If you find a mistake in the book, first let me offer you my apologies.
Second, if you have the time, please drop me a line at russ at russolsen.com with the page number and a quick description of the problem. If you take the trouble to report the problem I will include it in the erratta page here and will fold it into the paper book at the first possible opportunity. I will also thank you by name, so make sure you spell you name right!
Here are the out-and-out mistakes that have turned up since the book was published. Most of these have been fixed in the most recent printing.
Somehow I managed to go on for 300+ pages without ever once mentioning that I was using Ruby 1.8.6 to run all of the code. If 1.8.6 sounds absolutely ancient to you, take heart: I’ve updated the example code to run with Ruby 2.1 and the changes were minimal.
Preface / Page xxii
The final line of code on this page is missing some parentheses. The correct version is:
(divisor == 0) && puts('Division by zero')
Preface / Page xxiii
The logic in the final line of code on this page is incorrect. The correct version is:
file.eof? && puts('Reached end of file')
Chapter 1 / Page 12
The example at the bottom of the page would probably be better if the
sunday_drivemethod called the
stop_enginemethods instead of using
Chapter 2 / Page 32
The example of the
forloop at the bottom of the page would be much improved if it included an actual
forloop. The proper code is:
array = ['first', 'second', 'third'] for element in array puts element end
Chapter 2 / Page 47
The text just before the code example mentions the
Accountclass. This should be the
Chapter 3 / Pages 66 and 67
In the code examples at the bottom of pages 66 and 67, the
output_reportmethod should call the
Chapter 3 / Page 68
The sentence just before the code example references a variable called
formatter. It should be
Chapter 4 / Page 89
There is an ‘end’ missing from the code example in the middle of the page.
Chapter 5 / Pages 99-100
The sample output should report Fred’s new salary as 90000.0, not 80000.0 as shown incorrectly in the book. So much for stone age accounting.
Chapter 5 / Page 100
The class in the lower right of the UML diagram is incorrectly labeled
Employee. It should be either
Chapter 5 / Page 103
The last sentence in the footnote incorrectly says that calling
superwithout an argument list will result in the super class method being called with the parameters
payroll_manager. In fact, since
payroll_manageris not part of the original argument list it would not be passed by any call to
Chapter 5 / Page 105
Although not strictly a typo, it would have been better if I had noted that the observer added in the second code example can’t be removed because the code does not save a reference to the observer.
Chapter 6 / Pages 122
The name of the method in the last sentence on this page is incorrect. The correct method name is
Chapter 7 / Page 131
The class name
ArrayIteratoris misspelled in the last paragraph on this page.
Chapter 8 / Page 143
There is one thing too many in the last sentence on this page.
Chapter 8 / Page 159
DeleteEmployee.executemethod, should call
Chapter 10 / Page 190
In the middle of the page, the kind of athletics that your code should not require are mental, not metal.
Chapter 11 / Page 201
The last sentance of the second paragraph refers to
@componentwhen it really means
Chapter 11 / Pages 201-203
The text refers several times to an non-existant
writemethod. The correct method name name is
Chapter 14 / Page 256
In Figure 14-2, the uppermost horizonal arrow head should be solid: A Director is not an instance of a ComputerBuilder; rather it has a reference to a ComputerBuilder.
Chapter 14 / Page 256
In Figure 14-2, the labels “Desktop Computer” and “Laptop Computer” are reversed.
Chapter 15 / Page 271
The second non-code sentence from the bottom of the page should read:
With Or we can find all of the files that are either MP3s or bigger than 1K in one shot:
Chapter 17 / Page 305
The text at the bottom of the page says that the three methods are created by
member_of. In fact, they are created by
Chapter 18 / Pages 318-319
Several of the code examples on these pages refer to a non-existant
message.textattribute. The correct name is
Also the adapters on this page define a
sendmethod instead of the correct
Chapter 18 / Page 328
The 2nd bullet on the page refers to the Rails
viewdirectory. The correct directory name is plural:
Chapter 18 / Page 328
The first sentence of the third bullet should read:
- Rails applications typically use ActiveRecord to talk to the database.*
Many thanks to the following for pointing out these problems:
- Sam Aaron,
- Gus Gollings
- Jan Goldenbaum
- Dean Holdren
- John Hohlen
- Jochen Hayek
- Gary L. Johnson
- Michael Nah
- Glenn Ritz
- Brian Uri
- Juri Vainonen
- Howard Wong
- The French translation team of Laurent Julliard, Mikhail Kachakidze and Richard (with an ‘i’) Piacentini
- The Japanese translation team, especially Yumeto Yamagishi and Yutaka Sugano
- Sagar Pandya