From 530f7805ed5790af1d472a041bc74089dc183f47 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Thu, 1 Aug 2019 18:43:25 +0900 Subject: It may be better to explicitly require 'object/try' where we call `try` In most cases it works now without explicit require because it's accidentally required through active_support/core_ext/date_and_time/calculations.rb where we still call `try`, but that would stop working if we changed the Calculations implementation and remove the require call there. --- actionpack/lib/action_controller/metal/conditional_get.rb | 2 ++ actiontext/app/helpers/action_text/tag_helper.rb | 1 + actiontext/lib/action_text/attachment.rb | 2 ++ actiontext/lib/action_text/attachments/trix_conversion.rb | 2 ++ activemodel/lib/active_model/type/float.rb | 2 ++ .../lib/active_record/attribute_methods/time_zone_conversion.rb | 2 ++ .../lib/active_record/connection_adapters/postgresql_adapter.rb | 1 + activerecord/lib/active_record/railtie.rb | 1 + activestorage/app/jobs/active_storage/mirror_job.rb | 2 ++ activestorage/lib/active_storage/attached/model.rb | 2 ++ activestorage/test/test_helper.rb | 1 + activesupport/lib/active_support/core_ext/hash/conversions.rb | 1 + activesupport/lib/active_support/notifications/fanout.rb | 1 + railties/lib/rails/engine.rb | 1 + 14 files changed, 21 insertions(+) diff --git a/actionpack/lib/action_controller/metal/conditional_get.rb b/actionpack/lib/action_controller/metal/conditional_get.rb index f21e51a68a..c9bb84406a 100644 --- a/actionpack/lib/action_controller/metal/conditional_get.rb +++ b/actionpack/lib/action_controller/metal/conditional_get.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActionController module ConditionalGet extend ActiveSupport::Concern diff --git a/actiontext/app/helpers/action_text/tag_helper.rb b/actiontext/app/helpers/action_text/tag_helper.rb index 1dc6202ae1..fe40be74f5 100644 --- a/actiontext/app/helpers/action_text/tag_helper.rb +++ b/actiontext/app/helpers/action_text/tag_helper.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" require "action_view/helpers/tags/placeholderable" module ActionText diff --git a/actiontext/lib/action_text/attachment.rb b/actiontext/lib/action_text/attachment.rb index e90a3e7d48..4bd537c7c2 100644 --- a/actiontext/lib/action_text/attachment.rb +++ b/actiontext/lib/action_text/attachment.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActionText class Attachment include Attachments::TrixConversion, Attachments::Minification, Attachments::Caching diff --git a/actiontext/lib/action_text/attachments/trix_conversion.rb b/actiontext/lib/action_text/attachments/trix_conversion.rb index 24937d6c22..15319f4e37 100644 --- a/actiontext/lib/action_text/attachments/trix_conversion.rb +++ b/actiontext/lib/action_text/attachments/trix_conversion.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActionText module Attachments module TrixConversion diff --git a/activemodel/lib/active_model/type/float.rb b/activemodel/lib/active_model/type/float.rb index 36c7a5103c..435e39b2c9 100644 --- a/activemodel/lib/active_model/type/float.rb +++ b/activemodel/lib/active_model/type/float.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActiveModel module Type class Float < Value # :nodoc: diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index fb44232dff..9a4de1a034 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActiveRecord module AttributeMethods module TimeZoneConversion diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index f33ba87435..d6758c9d4b 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -12,6 +12,7 @@ class ::PG::Connection # :nodoc: end end +require "active_support/core_ext/object/try" require "active_record/connection_adapters/abstract_adapter" require "active_record/connection_adapters/statement_pool" require "active_record/connection_adapters/postgresql/column" diff --git a/activerecord/lib/active_record/railtie.rb b/activerecord/lib/active_record/railtie.rb index d5375390c7..f06a98bd98 100644 --- a/activerecord/lib/active_record/railtie.rb +++ b/activerecord/lib/active_record/railtie.rb @@ -2,6 +2,7 @@ require "active_record" require "rails" +require "active_support/core_ext/object/try" require "active_model/railtie" # For now, action_controller must always be present with diff --git a/activestorage/app/jobs/active_storage/mirror_job.rb b/activestorage/app/jobs/active_storage/mirror_job.rb index e34faedb56..e70629d6ec 100644 --- a/activestorage/app/jobs/active_storage/mirror_job.rb +++ b/activestorage/app/jobs/active_storage/mirror_job.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + # Provides asynchronous mirroring of directly-uploaded blobs. class ActiveStorage::MirrorJob < ActiveStorage::BaseJob queue_as { ActiveStorage.queues[:mirror] } diff --git a/activestorage/lib/active_storage/attached/model.rb b/activestorage/lib/active_storage/attached/model.rb index 06864a846f..4bd6b56b6c 100644 --- a/activestorage/lib/active_storage/attached/model.rb +++ b/activestorage/lib/active_storage/attached/model.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/object/try" + module ActiveStorage # Provides the class-level DSL for declaring an Active Record model's attachments. module Attached::Model diff --git a/activestorage/test/test_helper.rb b/activestorage/test/test_helper.rb index ac38b9362c..164b0acd96 100644 --- a/activestorage/test/test_helper.rb +++ b/activestorage/test/test_helper.rb @@ -6,6 +6,7 @@ require_relative "dummy/config/environment.rb" require "bundler/setup" require "active_support" require "active_support/test_case" +require "active_support/core_ext/object/try" require "active_support/testing/autorun" require "active_storage/service/mirror_service" require "image_processing/mini_magick" diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb index 5b48254646..dd021410a9 100644 --- a/activesupport/lib/active_support/core_ext/hash/conversions.rb +++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb @@ -5,6 +5,7 @@ require "active_support/time" require "active_support/core_ext/object/blank" require "active_support/core_ext/object/to_param" require "active_support/core_ext/object/to_query" +require "active_support/core_ext/object/try" require "active_support/core_ext/array/wrap" require "active_support/core_ext/hash/reverse_merge" require "active_support/core_ext/string/inflections" diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb index dda71b880e..b0f30d2995 100644 --- a/activesupport/lib/active_support/notifications/fanout.rb +++ b/activesupport/lib/active_support/notifications/fanout.rb @@ -3,6 +3,7 @@ require "mutex_m" require "concurrent/map" require "set" +require "active_support/core_ext/object/try" module ActiveSupport module Notifications diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb index b4c0028b1f..f8f5ff443a 100644 --- a/railties/lib/rails/engine.rb +++ b/railties/lib/rails/engine.rb @@ -3,6 +3,7 @@ require "rails/railtie" require "rails/engine/railties" require "active_support/core_ext/module/delegation" +require "active_support/core_ext/object/try" require "pathname" require "thread" -- cgit v1.2.3