Inspect rails tables and columns en massehacks

ActiveRecord::Base.connection.tables.flat_map do |table_name|
 ActiveRecord::Base.connection.columns(table_name).map do |c|
    [table_name, c.name, c.sql_type_metadata.sql_type, c.sql_type_metadata.type]
 end
end

Time an ActiveRecord Queryhacks

def time_query(q)
  start = Time.now
  r = ActiveRecord::Base.connection.execute(q)
  puts "Duration: #{Time.now - start}"
  return r
end