Skip to content

Instantly share code, notes, and snippets.

@ehlertij
Created September 26, 2012 16:07
Show Gist options
  • Save ehlertij/3788907 to your computer and use it in GitHub Desktop.
Save ehlertij/3788907 to your computer and use it in GitHub Desktop.
AREL SHOW TABLES logging
# config/initializers/arel.rb
module Arel
class Table
@@show_table_logger = Logger.new('log/show_tables.log')
def table_exists?
@table_exists ||= tables.key?(@name) || engine.connection.table_exists?(name)
@@show_table_logger.info "#{Time.now} - #{@name}" unless @table_exists
@table_exists
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment