Reputation: 1
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.
Upvotes: 0
Views: 443
Reputation: 3825
You could use:
MyModel.all.map &:attributes
Which is equivalent to:
MyModel.find(:all).collect {|x| x.attributes}
Upvotes: 4