Using "eval" to display a summary


Anyone can helps to display a summary list instead of a details list.

Here is my code;

recgroup = eval(tablename.fieldname) if !tablename.fieldname.nil?

puts recgroup[:textgroup] + recgroup[:countgroup].inject(0) {|sum,
room| sum + room.length}.to_s + '; ’ + recgroup[:countgroup].length.to_s
if !recgroup.nil?

It was displays as a details;

textdata1 1 1
textdata2 1 2
textdata1 2 2

But I need to display as a summary;

textdata1 3 3
textdata2 1 2


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs