I would like to create an array in my controller from the underlying database, which I will eventually render in JSON.
The database is called User with the fields name:string and value:integer
At the moment I have the following in my controller:
class GraphController < ApplicationController
def index
end
def data
render :json => User.select('value')
end
end
but this returns a hash of id and value whereas I would like an array of value numbers only. How can I achieve this?
User.select('value').values