Skip to content

Commit

Permalink
Deprecate ActiveRecord::Base.colorize_logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 13, 2010
1 parent 743cafb commit 8d78a82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 7 additions & 8 deletions activerecord/lib/active_record/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,6 @@ def self.reset_subclasses #:nodoc:
cattr_accessor :pluralize_table_names, :instance_writer => false
@@pluralize_table_names = true

##
# :singleton-method:
# Determines whether to use ANSI codes to colorize the logging statements committed by the connection adapter. These colors
# make it much easier to overview things during debugging (when used through a reader like +tail+ and on a black background), but
# may complicate matters if you use software like syslog. This is true, by default.
cattr_accessor :colorize_logging, :instance_writer => false
@@colorize_logging = true

##
# :singleton-method:
# Determines whether to use Time.local (using :local) or Time.utc (using :utc) when pulling dates and times from the database.
Expand Down Expand Up @@ -557,6 +549,13 @@ def self.reset_subclasses #:nodoc:
self.default_scoping = []

class << self # Class methods
def colorize_logging(*args)
ActiveSupport::Deprecation.warn "ActiveRecord::Base.colorize_logging and " <<
"config.active_record.colorize_logging are deprecated. Please use " <<
"Rails::Subscriber.colorize_logging or config.colorize_logging instead", caller
end
alias :colorize_logging= :colorize_logging

# Find operates with four different retrieval approaches:
#
# * Find by id - This can either be a specific id (1), a list of ids (1, 5, 6), or an array of ids ([5, 6, 10]).
Expand Down
2 changes: 1 addition & 1 deletion activerecord/test/cases/base_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ def test_mass_assignment_protection
end

def test_mass_assignment_protection_against_class_attribute_writers
[:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names, :colorize_logging,
[:logger, :configurations, :primary_key_prefix_type, :table_name_prefix, :table_name_suffix, :pluralize_table_names,
:default_timezone, :schema_format, :lock_optimistically, :record_timestamps].each do |method|
assert Task.respond_to?(method)
assert Task.respond_to?("#{method}=")
Expand Down

0 comments on commit 8d78a82

Please sign in to comment.