Problem: To retrive a specific column by method.find

ActiveRecord works at the row (aka record) level, not the column level. That's not to say that you can't just get a single column of data back from the database, you can, but you won't have all the attributes if you do this so just keep that in mind. you'll probably want to map them to an array

try something like:

class User < ActiveRecord::Base   def self.names     # find all records, then map name attributes to an array     find(:all, :select => "name").map(&:name)   end end

then just do

@names = User.names

in your controller methods where you need it



is shorthand for

.map { |x| }