I have this array that looks like this.
@a = ["foo","bar"].join(",")
But i would like to retrieve the "foo" and "bar" through a loop from my database instead of creating them manually and insert them into the array. How would i do that? For instance i have data, in which i want all the usernames to be put in an array and be seperated by the ",". How can i put all usernames into the array?
@data = Data.all
@data.each do |d|
d.username
end