get all user.name from a database rails
ruby, ruby-on-rails
Solution
You should try :
User.all.collect(&:name)
or
User.select("name")
Problem
I'm guessing how to retrieve just the names of all the records from a database. The easy way is something like this: ``` @user=User.all @list=[] @user.each do|u| @list.push(u.name) end ``` but I'm sure if it has to be a oneline query on irb that must fit. Does anyone has an idea?