lib/hirb/helpers/auto_table.rb in cldwalker-hirb-0.1.2 vs lib/hirb/helpers/auto_table.rb in cldwalker-hirb-0.2.0
- old
+ new
@@ -1,11 +1,11 @@
-# Attempts to autodetect the table class the output represents and delegates rendering to it.
+# Detects the table class the output should use and delegates rendering to it.
class Hirb::Helpers::AutoTable
# Same options as Hirb::Helpers::Table.render.
def self.render(output, options={})
klass = if ((output.is_a?(Array) && output[0].is_a?(ActiveRecord::Base)) or output.is_a?(ActiveRecord::Base) rescue false)
Hirb::Helpers::ActiveRecordTable
- elsif options[:fields]
+ elsif (output.is_a?(Array) && !(output[0].is_a?(Hash) || output[0].is_a?(Array)))
Hirb::Helpers::ObjectTable
else
Hirb::Helpers::Table
end
klass.render(output, options)
\ No newline at end of file