From: David A. Black [email protected]
To: ruby-talk ML [email protected]
Sent: Tuesday, July 14, 2009 7:43:56 AM
Subject: Re: Twelve rules of Ruby
The Well-Grounded Rubyist
I suppose I’m very teaching-oriented, in the sense that I’m mainly
interested in “rules” for understanding and using Ruby successfully. I
don’t think there’s that much point making a list of how self works
in the absence of explaining why (at least in part) it’s important to
Of course, there are no twelve rules. Better is for everyone to
interpret the invitation how they see fit. We don’t have to (and
won’t, and can’t) reach some kind of twelve-rule consensus. That’s a
 In a method definition, it’s the object that received the message.
In a or module class definition body, outside of a method definition,
it’s the class or module object. At the top level, it’s a special
“backstop” object called “main”. In an instance_eval or instance_exec
block, it’s the receive of the instance_eval message. In a
class_/module_eval block, it’s the class or module object. That’s off
the top of my head (too lazy to look at the book sitting next to me
but I think that’s about it.
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now available: The Well-Grounded Rubyist (The Well-Grounded Rubyist)
Training! Intro to Ruby, with Black & Kastner, September 14-17
(More info: http://rubyurl.com/vmzN)
– END of David’s Reply.
Yep, I suspected myself that trying to state the rules might make a tome
of a rule … but those rules there are also worth the price of
admission, Now i know what self is.
Just for curiosity I looked up the etiology of red herring and got this
I looked at the book online with interest. One of the frustrations for
me is that I have some older books on Ruby I bought a few years ago …
I got one that tells the student to try to implement something, and
mentions that it is easy to do it wrong, but the author never explains
what he thinks is the “Right” way of doing things. Now that I am laid
off and urgently adding Ruby to my set of programmer skills, things in
these books simply do not work any more and I am left to guess around
trying to get things working.
Example: I am following an example from the book Ruby from novice to
Professional … and I am directed to use scaffolds to create my working
project, but the procedure does not create a working program any more
(The scaffold does NOT pick up the fields in the record, so trying to
create a new record, just shows the header, the save button and the back
Neither me, nor my friend who has for years been making a living
programming Rails and Ruby from his living room knows if this is a bug
or an intentional change, or if there is some new syntax to make
scaffold create a complete scaffold instead of a ladder with no rungs.
The reason I bring this frustration out, is I am interested in finding a
book that doesn’t leave me in the lurch of having to make guesses with
no guidance, and where the examples work with the current version of
ruby in wide use today. Surprises are like being in a dark cave and
having your flashlight go out without warning.
My rails is 2.3.2 and Ruby version 1.8.6