table_print
table_print copied to clipboard
How would I configure the default tp in a Rails initializer?
Using this in a rails app. How would I configure the default tp in a Rails initializer?
For example, I'd like to make headers always lowercase via:
tp.set :capitalize_headers, false
But I don't want to have to do that every time. Do I need to make my own wrapper?
Came up with this:
Toco::Application.configure do
config.after_initialize do
TablePrintConfigurator.set_defaults
end
end
class TablePrintConfigurator
def self.set_defaults
tp.set Transaction, :id, :description, :amount, :total_cost, :active, :charge_id, :charge_type, :invoice_id, :multiplier, :transaction_type_id, :trx_date, :created_at, :updated_at
...
end
end