%script{:src => url('/result.js')} .rezult - if @result - if @result.rows? - if @result.count > 0 - fields = @result.fields %strong= "Total: #{@result.count}" - if @result.pages > 1 = haml :pages, :layout => false %table.result %thead - if fields.any?{|f| f.include?('.')} - tables = extract_tables(fields) %tr - tables.each do |t| %th{:colspan => t.columns.size}&= t.table %tr - tables.map(&:columns).flatten.each do |column| %th&= column - else %tr - fields.each do |field| %th&= field %tbody - @result.rows.each do |row| - row_ids = {} %tr - fields.each do |field| - value = row[field] - if field =~ /([\w\.]+)\.(\w+)/ - table, column = $1, $2 - if column == 'id' - row_ids[table] = value - is_id = true - else - is_id = false - data = { :table => table, :column => column, :id => row_ids[table], :value => value, :nil => value.nil? } - else - data = nil - if value == nil - value = 'nil' - empty = true - elsif value =~ /^\s*$/ - value = '"'+value+'"' - empty = true %td{:class => [(empty && 'inspect'), data && data[:column] == 'id' && 'id'], :data => data} - if value !~ /^\S+$/ %pre= preserve(html_escape(value)) - elsif is_id %span.actions   = value - else = value - if @result.pages > 1 = haml :pages, :layout => false :javascript fill_id_with_edit_delete($('table.result')); - else Has no returned rows - elsif @result.value? Rezult: &= @result.value.inspect - elsif @result.error? Error: &= @result.error.class.name %br/ Message: &= @result.error.message %br/ Traceback: %pre - @result.error.backtrace.each do |l| &= l.sub(Rails.root, '') - else Has no result