views:

211

answers:

1

Hi,

I am using Ruby, I want data in array of hash format.

I have tried out ActiveRecord's select_al method. But it returns all the data in string format, does not matter what type is its type in data base. All numbers are also returned in string format.

Please, give your valuable suggestions.

Thank you all for your precious time.

Thanks and Regards,

SachinJadhav

+4  A: 

You could use:

MyModel.all.map &:attributes

Which is equivalent to:

MyModel.find(:all).collect {|x| x.attributes}
giorgian