table_print
table_print copied to clipboard
dup the klass config on retrieval so it does not clear between calls
The current code modifies the config returned by TablePrint::Config.for
so calling TablePrint::Config.set
works only once:
pry(main)> TablePrint::Config.set(Entry, include: ['entry_type','account.name'])
=> {:include=>["entry_type", "account.name"]}
pry(main)> tp Entry.last(10)
... shows the entry_type and account.name columns
pry(main)> tp Entry.last(10)
... doesn't show the entry_type and account.name columns anymore
This PR changes the for
to return a copy of the config so it doesn't get cleared.