board.voters_who_voted
returns an array containing rows from the User table. The attribute I want to pull out is the name.
Example output (only one user here):
[#<User id: 71, name: "montgomery Thamavaranacupt", email: "jmash@aol.com", created_at: "2013-01-27 05:32:30", updated_at: "2013-04-24 07:07:43", password_digest: "$2a$10$Es/olEq0.w6vcnn4.8v0.O0VXDP1c7nktcW85UFtG91e...", remember_token: "ttPm1aTE6WBm3WVx4EJTew", admin: false, image_file_name: nil, image_content_type: nil, image_file_size: nil, image_updated_at: nil, avatar: 0>]
I suppose I need to iterate through the entire array and print the names.
This is what I tried:
board.voters_who_voted.each {|x| puts x.name}
however this just returns the entire array for some reason
board.voters_who_voted[0].name
the above properly returns the name of the first user but i need this for all of them
tag within the quotes title: "#{board.voters_who_voted.collect(&:name).join("\n")}" what i had. \n still does nothing – Jaqx May 20 '13 at 14:26