lib/table_go.rb in table_go-0.2.3 vs lib/table_go.rb in table_go-0.2.4
- old
+ new
@@ -16,10 +16,10 @@
def self.render_csv(collection, model_klass, options = {}, &block)
render(collection, model_klass, Renderers::CsvRenderer, nil, options, &block)
end
def self.render(collection, model_klass, renderer_klass, template, options = {}, &block)
- table = Table.new(collection, model_klass, options, &block)
+ table = Table.new(collection.respond_to?(:each) ? collection : [collection], model_klass, options, &block)
renderer = TableRenderer.new(table)
renderer.renderer_klass = renderer_klass
renderer.template = template
renderer.render_template
end
\ No newline at end of file