Go back to the main page

Show a tables indexes within a Rails console

This article is over 2 years old. Proceed with caution.

Regards ♨ – Minimul

 


ActiveRecord::Base.connection.select_all('SHOW INDEX FROM transactions').map { |t| t['Key_name'] }
Comment on this article?