i have hash:
users = { 'name' => name, 'last_name' => last_name, 'photo' => photo, 'address' => address, }
save in csv:
csv.open("users.csv", "a") {|csv| users.to_a.each {|elem| csv << elem}}
output:
name, jake last_name,kallen photo, http://avs.ru/leto_3434.jpg address, new york name, dan last_name,leans photo, http://avs.ru/leto_3423.jpg address, new york
i need file:
jake,kallen,http://avs.ru/leto_3434.jpg,new york
how change code need? me please.
upd: forgot point out lot of users
csv.open("users.csv", "a") {|csv| csv << users.values }
i think, need this. if users
hash contains other data - csv take to
Comments
Post a Comment