Sha256: 922aeb02269a5cc8c2245f4b1e0bec2ed4cd2bbd6a960208673e244ca56f5933
Contents?: true
Size: 567 Bytes
Versions: 4
Compression:
Stored size: 567 Bytes
Contents
class Hirb::Helpers::ActiveRecordTable < Hirb::Helpers::ObjectTable # Rows are Rails' ActiveRecord::Base objects. # Takes same options as Hirb::Helpers::Table.render except as noted below. # # Options: # :fields- Can be any attribute, column or not. If not given, this defaults to the database table's columns. def self.render(rows, options={}) rows = [rows] unless rows.is_a?(Array) options[:fields] ||= begin fields = rows.first.class.column_names fields.map {|e| e.to_sym } end super(rows, options) end end
Version data entries
4 entries across 4 versions & 2 rubygems