Do a set of records have the same value for one of the fields?

Hi Folks,
I’m looking for an elegant Ruby one-liner…

I have a set of records in my database that I want to check to see if
the :description field is identical.

And, because it’s Thursday morning (where I live), I would like to do
it as elegantly and as one-line-er-ly as I can

Something like…

which, doesn’t work

I’ll go ahead and split it into a couple of lines, and make sure that
all of the descriptions match record[0].descriptions, but I am certain
there is a more elegant solution than this.


On 27 Aug 2009, at 15:09, Patrick D. wrote:

Something like…

Well if you’re desperate for a one-liner == 1


nice… I was trying to figure out something with #inject/#sum, but
that looks great.