Skip to content

Instantly share code, notes, and snippets.

@kivanio
Forked from rummelonp/nyan.rb
Created June 23, 2014 00:39
Show Gist options
  • Save kivanio/545199828fba36a2fb4c to your computer and use it in GitHub Desktop.
Save kivanio/545199828fba36a2fb4c to your computer and use it in GitHub Desktop.
class ActiveRecord::Base
def self.indexes
connection.indexes(table_name)
end
def self.indexes_by_column(column_name)
indexes.select { |i| i.columns.include?(column_name.to_s) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment