how can i map two column in single rails query

activerecord, ruby-on-rails-3

Solution

If I understood correctly, you can do:

@profiles = Profile.all.map{|p| "#{p.users_firstname} #{p.users_lastname}"}

Problem

How can i map two columns in single rails query. Eg. ``` @profiles = Profile.all.map(&:user_firstname) ``` After running this query i would able to get users_firstname form table(which is right). But how can i add users_firstname and users_lastname in above query.

Original source