I tried to do this, and I came up with my own way to do it.
I like to encapsulate if in a model called Service , which is not an active write model
my model looks like
class Maintenance def self.show_all_tables_count list_table_with_count = [] ActiveRecord::Base.connection.tables.each do |table| unless ['ar_internal_metadata', 'schema_migrations'].include?(table) list_table_with_count << [name: table, count: table.singularize.camelize.constantize.count] end end list_table_with_count end end
I hope this helps
Mzaragoza
source share