From bef95d372f9104a321cf17ac9f45316e9caac920 Mon Sep 17 00:00:00 2001 From: Koichi ITO Date: Wed, 24 May 2017 15:21:02 +0900 Subject: [PATCH] Fix a RuboCop offences using `rubocop -a` --- activerecord/lib/active_record/integration.rb | 1 - activerecord/lib/active_record/tasks/database_tasks.rb | 6 +++--- activerecord/test/cases/associations/callbacks_test.rb | 2 +- activesupport/lib/active_support/cache.rb | 2 -- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index 441237da1eb..32362fa86f7 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -110,7 +110,6 @@ module ActiveRecord end end - module ClassMethods # Defines your model's +to_param+ method to generate "pretty" URLs # using +method_name+, which can be any attribute or method that diff --git a/activerecord/lib/active_record/tasks/database_tasks.rb b/activerecord/lib/active_record/tasks/database_tasks.rb index c53dee43d70..ba686fc5627 100644 --- a/activerecord/lib/active_record/tasks/database_tasks.rb +++ b/activerecord/lib/active_record/tasks/database_tasks.rb @@ -71,9 +71,9 @@ module ActiveRecord @tasks[pattern] = task end - register_task(/mysql/, 'ActiveRecord::Tasks::MySQLDatabaseTasks') - register_task(/postgresql/, 'ActiveRecord::Tasks::PostgreSQLDatabaseTasks') - register_task(/sqlite/, 'ActiveRecord::Tasks::SQLiteDatabaseTasks') + register_task(/mysql/, "ActiveRecord::Tasks::MySQLDatabaseTasks") + register_task(/postgresql/, "ActiveRecord::Tasks::PostgreSQLDatabaseTasks") + register_task(/sqlite/, "ActiveRecord::Tasks::SQLiteDatabaseTasks") def db_dir @db_dir ||= Rails.application.config.paths["db"].first diff --git a/activerecord/test/cases/associations/callbacks_test.rb b/activerecord/test/cases/associations/callbacks_test.rb index 7721bd5cd99..f9d1e445950 100644 --- a/activerecord/test/cases/associations/callbacks_test.rb +++ b/activerecord/test/cases/associations/callbacks_test.rb @@ -128,7 +128,7 @@ class AssociationCallbacksTest < ActiveRecord::TestCase assert ar.developers_log.empty? alice = Developer.new(name: "alice") ar.developers_with_callbacks << alice - assert_equal"after_adding#{alice.id}", ar.developers_log.last + assert_equal "after_adding#{alice.id}", ar.developers_log.last bob = ar.developers_with_callbacks.create(name: "bob") assert_equal "after_adding#{bob.id}", ar.developers_log.last diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 44f80dd379a..a1093a2e231 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -536,7 +536,6 @@ module ActiveSupport end end - # Prefixes a key with the namespace. Namespace and key will be delimited # with a colon. def normalize_key(key, options) @@ -587,7 +586,6 @@ module ActiveSupport ActiveSupport::Notifications.instrument("cache_#{operation}.active_support", payload) { yield(payload) } end - def log return unless logger && logger.debug? && !silence? logger.debug(yield)