Skip to content

Commit

Permalink
It may be better to explicitly require 'object/try' where we call try
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
amatsuda committed Aug 1, 2019
1 parent 03018cb commit 530f780
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions 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
Expand Down
1 change: 1 addition & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
2 changes: 2 additions & 0 deletions 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:
Expand Down
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "active_support/core_ext/object/try"

module ActiveRecord
module AttributeMethods
module TimeZoneConversion
Expand Down
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions activerecord/lib/active_record/railtie.rb
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions 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] }
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
1 change: 1 addition & 0 deletions activestorage/test/test_helper.rb
Expand Up @@ -6,6 +6,7 @@
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"
Expand Down
Expand Up @@ -5,6 +5,7 @@
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"
Expand Down
1 change: 1 addition & 0 deletions activesupport/lib/active_support/notifications/fanout.rb
Expand Up @@ -3,6 +3,7 @@
require "mutex_m"
require "concurrent/map"
require "set"
require "active_support/core_ext/object/try"

module ActiveSupport
module Notifications
Expand Down
1 change: 1 addition & 0 deletions railties/lib/rails/engine.rb
Expand Up @@ -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"

Expand Down

0 comments on commit 530f780

Please sign in to comment.