I had a old script that worked for me on rails 4
ActiveRecord::Base.connection.tables.map { |t| "#{t} => " + ActiveRecord::Base.connection.execute("select count(*) from #{t}").first['count'] }
but this is not returning anything on a rails 5 project :(