Errata

Ruby Best Practices

Errata for Ruby Best Practices

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 44
just above the middle

if the TCPSocket.new message fails in the method

Note from the Author or Editor:
pp44-45, anywhere you see socket.close, please replace with:

socket.close if socket

Wolfgang Kittenberger  Jul 29, 2009  Feb 16, 2018
Printed
Page 47
Example at the bottom

As described later in Appendix C section

Daniel Kirsch  Jul 12, 2009 
Printed
Page 137
2nd code fragment

In self.authenticate, new() is called with two arguments. The initializer only has one parameter. Note: wrong number of arguments in Ruby 1.8.

Note: very useful book.

Note from the Author or Editor:
Confirmed. Initialize method should be replaced with:
http://pastie.org/830829

Jeffrey L. Taylor  Nov 24, 2009 
Printed
Page 139
middle of page: def fib(n)

before defining fib so you need to initialize @series somehow, e.g.:
@series=Array.new
@series[0] = 0
@series[1[ = 1
otherwise you will get a NoMethodError: undefined method `[]=' for nil:NilClass

Note from the Author or Editor:
Change example on p139 to:

def fib(n)
@series ||= []
@series[n] ||= fib(n-1) + fin(n-2)
end

Wolfgang Kittenberger  Aug 08, 2009 
Printed
Page 196
Figure 7.1

The submit button displayed in Figure 7.1 displays 'Shoot!',
while the ERB template that is supposed to generate it uses
the value 'Shoot'

Note from the Author or Editor:
Replace template line with:

<input type="submit" value="Shoot!">

K.Oster  Aug 02, 2009  Feb 16, 2018
Printed
Page 197
code fragment at bottom of page

The second entry in the assignment to winning_combos should be
[

Note from the Author or Editor:
Necessary change is as reported. (This is not a duplicate, see page number)

K.Oster  Aug 02, 2009 
Printed
Page 200
code fragment at top of page

The second entry in the assignment to winning_combos should be
[

Note from the Author or Editor:
Necessary correction is as reported.

K.Oster  Aug 02, 2009 
Printed
Page 216
Last paragraph

Note from the Author or Editor:
Required change is exactly as reported

K.Oster  Aug 02, 2009