Created
September 21, 2009 22:26
-
-
Save jerodsanto/190606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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