Skip to content

Instantly share code, notes, and snippets.

@jerodsanto
Created September 21, 2009 22:26
Show Gist options
  • Save jerodsanto/190606 to your computer and use it in GitHub Desktop.
Save jerodsanto/190606 to your computer and use it in GitHub Desktop.
require 'hirb'
# don't show [created|updated|deleted]_at fields from ActiveRecord tables
class Hirb::Helpers::MyActiveRecordTable < Hirb::Helpers::ActiveRecordTable
def self.render(rows,opts={})
rows = [rows] unless rows.is_a?(Array)
opts[:fields] = rows.first.class.columns.reject {|c| c.type == :datetime}.map {|c| c.name.to_sym}
super(rows, opts)
end
end
Hirb.enable :output => {
"ActiveRecord::Base" => {:class => :my_active_record_table, :ancestor => true}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment