I'm trying to return some json to the calling action. One of the params I want to pass is an array of arrays built from looping through a collection as so:
render :json => {
:rows => @classrooms.each do |classroom|
[classroom.name, classroom.students.count]
end
}
However, this sets :rows to the entire collection as opposed to what I want:
[[classroom, students],[classroom, students],[classroom, students]]
Is there any way of looping through the collection and returning an array in a single block?