2010-09-23 06:01:40 +00:00
|
|
|
if %w(test development).include?(ENV["RAILS_ENV"])
|
2010-09-03 11:26:20 +00:00
|
|
|
|
2010-09-23 06:01:40 +00:00
|
|
|
require "silent-postgres/railtie"
|
|
|
|
|
|
|
|
module SilentPostgres
|
|
|
|
SILENCED_METHODS = %w(tables indexes column_definitions pk_and_sequence_for last_insert_id)
|
|
|
|
|
|
|
|
def self.included(base)
|
|
|
|
SILENCED_METHODS.each do |m|
|
|
|
|
base.send :alias_method_chain, m, :silencer
|
|
|
|
end
|
2010-09-03 11:26:20 +00:00
|
|
|
end
|
2010-09-23 06:01:40 +00:00
|
|
|
|
|
|
|
SILENCED_METHODS.each do |m|
|
|
|
|
eval <<-METHOD
|
|
|
|
def #{m}_with_silencer(*args)
|
|
|
|
@logger.silence do
|
|
|
|
#{m}_without_silencer(*args)
|
|
|
|
end
|
2010-09-03 11:26:20 +00:00
|
|
|
end
|
2010-09-23 06:01:40 +00:00
|
|
|
METHOD
|
|
|
|
end
|
2010-09-03 11:26:20 +00:00
|
|
|
end
|
2010-09-03 11:40:07 +00:00
|
|
|
|
|
|
|
end
|
2010-09-23 06:01:40 +00:00
|
|
|
|