J
John William
New to ruby
If I have an Array
@sample_array
How do I display the attr_accessors in a table
This doesn’t seem to be the right way as it repeats the table each time
it iterates through the array.
Thanks,
John
@sample_array.each do |t|
puts "<table width='1000' border='1' cellspacing='3' cellpadding='0'>"
puts"<tr><td>#{t.name}</td><td>#{t.address}</td><td>#{t.city}</td><td>#{t.state}</td></
tr>"
puts “</table>â€
end
If I have an Array
@sample_array
How do I display the attr_accessors in a table
This doesn’t seem to be the right way as it repeats the table each time
it iterates through the array.
Thanks,
John
@sample_array.each do |t|
puts "<table width='1000' border='1' cellspacing='3' cellpadding='0'>"
puts"<tr><td>#{t.name}</td><td>#{t.address}</td><td>#{t.city}</td><td>#{t.state}</td></
tr>"
puts “</table>â€
end