attribute_names and/or values?

Hi rubyists,

I'm clunking around with this problem. I want to return an array of values from each record in my database table. I have this so far: @t = Table.find(:all)

@t.each do |k| k.attributes end

the method attributes returns a hash and attribute_names returns an array or the keys. Is there a method that returns an array of the values?

Thanks, Bryce

May be can try this:

@t.map do |k|   k.attributes.values end

# return [[value1, value2, value3], [value1, value2, value3] ...]

Herry

Thanks a lot, the code worked great after a couple of tweaks to the code above it.

Any reason that

@t.map do |k|   k.attributes.values end

works and

@t.each do |k|   k.attributes.values end

(map vs. each) doesn't work?