mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
register the obsolescence of require_dependency in the CHANGELOG [ci skip]
This commit is contained in:
parent
f6bc742835
commit
f2902edc0c
2 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,13 @@
|
|||
* `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
|
||||
mode. The method is not deprecated as such (yet), but applications are
|
||||
encouraged to not use it.
|
||||
|
||||
In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
|
||||
defensive with load order. Just refer to classes and modules normally. If
|
||||
the constant name is dynamic, camelize if needed, and constantize.
|
||||
|
||||
*Xavier Noria*
|
||||
|
||||
* Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
|
||||
|
||||
```ruby
|
||||
|
|
|
@ -263,9 +263,8 @@ module ActiveSupport #:nodoc:
|
|||
|
||||
# <b>Warning:</b> This method is obsolete in +:zeitwerk+ mode. In
|
||||
# +:zeitwerk+ mode semantics match Ruby's and you do not need to be
|
||||
# defensive with load order. Just refer to classes an modules normally. If
|
||||
# the class or module name is dynamic, camelize if needed, and
|
||||
# constantize.</b>
|
||||
# defensive with load order. Just refer to classes and modules normally.
|
||||
# If the constant name is dynamic, camelize if needed, and constantize.
|
||||
#
|
||||
# In +:classic+ mode, interprets a file using +mechanism+ and marks its
|
||||
# defined constants as autoloaded. +file_name+ can be either a string or
|
||||
|
@ -277,11 +276,9 @@ module ActiveSupport #:nodoc:
|
|||
# relative name in different namespaces whose evaluation would depend on
|
||||
# load order otherwise.
|
||||
#
|
||||
# Engines which do not control the mode in which their parent application
|
||||
# runs should call +require_dependency+ if a parent application running in
|
||||
# +:classic+ mode would need it to guarantee load order. This use case is
|
||||
# emulated in +:zeitwerk+ mode, which also loads the file and expects it
|
||||
# to match the corresponding constant.
|
||||
# Engines that do not control the mode in which their parent application
|
||||
# runs should call +require_dependency+ where needed in case the runtime
|
||||
# mode is +:classic+.
|
||||
def require_dependency(file_name, message = "No such file to load -- %s.rb")
|
||||
file_name = file_name.to_path if file_name.respond_to?(:to_path)
|
||||
unless file_name.is_a?(String)
|
||||
|
|
Loading…
Reference in a new issue