Module: Greentable::ViewHelpers

Defined in:
lib/greentable/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#greentable(records, opts = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/greentable/view_helpers.rb', line 5

def greentable(records, opts = {}, &block)
  begin
    gt = Table.new(self,records, opts)
    gt.process(&block)
    gt.to_s.html_safe
  rescue => e
    concat("<b>"+e.message+"</b><br><br>".html_safe)
    concat(e.backtrace.each{|x| x.to_s}.join('<br>').html_safe)
    return e
  end
end