activesupport 3.0.20 → 3.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (110) hide show
  1. data/CHANGELOG +14 -66
  2. data/README.rdoc +1 -1
  3. data/lib/active_support/backtrace_cleaner.rb +1 -1
  4. data/lib/active_support/buffered_logger.rb +4 -11
  5. data/lib/active_support/cache.rb +12 -15
  6. data/lib/active_support/cache/file_store.rb +3 -2
  7. data/lib/active_support/cache/mem_cache_store.rb +11 -3
  8. data/lib/active_support/cache/strategy/local_cache.rb +28 -23
  9. data/lib/active_support/callbacks.rb +195 -175
  10. data/lib/active_support/concern.rb +105 -35
  11. data/lib/active_support/configurable.rb +41 -2
  12. data/lib/active_support/core_ext/array/access.rb +2 -2
  13. data/lib/active_support/core_ext/array/random_access.rb +10 -7
  14. data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -2
  15. data/lib/active_support/core_ext/class/attribute.rb +27 -17
  16. data/lib/active_support/core_ext/class/inheritable_attributes.rb +12 -86
  17. data/lib/active_support/core_ext/class/subclasses.rb +20 -34
  18. data/lib/active_support/core_ext/date/calculations.rb +14 -2
  19. data/lib/active_support/core_ext/date/conversions.rb +6 -0
  20. data/lib/active_support/core_ext/date_time/calculations.rb +26 -9
  21. data/lib/active_support/core_ext/date_time/conversions.rb +1 -1
  22. data/lib/active_support/core_ext/date_time/zones.rb +1 -1
  23. data/lib/active_support/core_ext/enumerable.rb +2 -5
  24. data/lib/active_support/core_ext/float/rounding.rb +1 -1
  25. data/lib/active_support/core_ext/hash.rb +1 -0
  26. data/lib/active_support/core_ext/hash/conversions.rb +23 -36
  27. data/lib/active_support/core_ext/hash/deep_dup.rb +11 -0
  28. data/lib/active_support/core_ext/hash/keys.rb +6 -4
  29. data/lib/active_support/core_ext/hash/reverse_merge.rb +9 -14
  30. data/lib/active_support/core_ext/kernel/reporting.rb +19 -0
  31. data/lib/active_support/core_ext/logger.rb +11 -38
  32. data/lib/active_support/core_ext/module/attr_accessor_with_default.rb +11 -12
  33. data/lib/active_support/core_ext/module/attr_internal.rb +13 -6
  34. data/lib/active_support/core_ext/module/deprecation.rb +2 -0
  35. data/lib/active_support/core_ext/object.rb +1 -1
  36. data/lib/active_support/core_ext/object/blank.rb +42 -9
  37. data/lib/active_support/core_ext/object/duplicable.rb +48 -9
  38. data/lib/active_support/core_ext/object/inclusion.rb +15 -0
  39. data/lib/active_support/core_ext/object/instance_variables.rb +1 -35
  40. data/lib/active_support/core_ext/object/to_param.rb +13 -8
  41. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  42. data/lib/active_support/core_ext/object/try.rb +27 -10
  43. data/lib/active_support/core_ext/object/with_options.rb +19 -5
  44. data/lib/active_support/core_ext/range.rb +1 -0
  45. data/lib/active_support/core_ext/range/cover.rb +3 -0
  46. data/lib/active_support/core_ext/string.rb +1 -0
  47. data/lib/active_support/core_ext/string/filters.rb +3 -3
  48. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  49. data/lib/active_support/core_ext/string/inquiry.rb +13 -0
  50. data/lib/active_support/core_ext/string/multibyte.rb +1 -1
  51. data/lib/active_support/core_ext/string/output_safety.rb +33 -89
  52. data/lib/active_support/core_ext/time/calculations.rb +14 -13
  53. data/lib/active_support/core_ext/time/conversions.rb +2 -24
  54. data/lib/active_support/core_ext/time/marshal.rb +0 -1
  55. data/lib/active_support/core_ext/time/zones.rb +32 -21
  56. data/lib/active_support/core_ext/uri.rb +8 -0
  57. data/lib/active_support/dependencies.rb +93 -37
  58. data/lib/active_support/deprecation.rb +2 -2
  59. data/lib/active_support/deprecation/behaviors.rb +7 -0
  60. data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
  61. data/lib/active_support/deprecation/reporting.rb +4 -0
  62. data/lib/active_support/duration.rb +4 -0
  63. data/lib/active_support/file_update_checker.rb +1 -1
  64. data/lib/active_support/file_watcher.rb +36 -0
  65. data/lib/active_support/gzip.rb +0 -1
  66. data/lib/active_support/hash_with_indifferent_access.rb +6 -4
  67. data/lib/active_support/i18n.rb +0 -1
  68. data/lib/active_support/i18n_railtie.rb +2 -2
  69. data/lib/active_support/inflector/inflections.rb +1 -1
  70. data/lib/active_support/json/decoding.rb +37 -23
  71. data/lib/active_support/json/encoding.rb +8 -3
  72. data/lib/active_support/lazy_load_hooks.rb +7 -7
  73. data/lib/active_support/log_subscriber.rb +3 -3
  74. data/lib/active_support/log_subscriber/test_helper.rb +4 -3
  75. data/lib/active_support/message_encryptor.rb +1 -1
  76. data/lib/active_support/message_verifier.rb +1 -1
  77. data/lib/active_support/multibyte/chars.rb +4 -3
  78. data/lib/active_support/multibyte/unicode.rb +1 -1
  79. data/lib/active_support/notifications.rb +9 -8
  80. data/lib/active_support/notifications/fanout.rb +3 -3
  81. data/lib/active_support/ordered_hash.rb +19 -2
  82. data/lib/active_support/ordered_options.rb +33 -3
  83. data/lib/active_support/railtie.rb +1 -1
  84. data/lib/active_support/rescuable.rb +1 -0
  85. data/lib/active_support/secure_random.rb +11 -5
  86. data/lib/active_support/test_case.rb +2 -10
  87. data/lib/active_support/testing/assertions.rb +17 -6
  88. data/lib/active_support/testing/mochaing.rb +7 -0
  89. data/lib/active_support/testing/pending.rb +27 -23
  90. data/lib/active_support/testing/setup_and_teardown.rb +8 -11
  91. data/lib/active_support/time_with_zone.rb +6 -3
  92. data/lib/active_support/version.rb +3 -3
  93. data/lib/active_support/whiny_nil.rb +1 -1
  94. data/lib/active_support/xml_mini.rb +4 -2
  95. data/lib/active_support/xml_mini/jdom.rb +9 -16
  96. data/lib/active_support/xml_mini/libxml.rb +1 -0
  97. data/lib/active_support/xml_mini/libxmlsax.rb +2 -1
  98. data/lib/active_support/xml_mini/nokogiri.rb +1 -0
  99. data/lib/active_support/xml_mini/nokogirisax.rb +1 -0
  100. data/lib/active_support/xml_mini/rexml.rb +1 -0
  101. metadata +50 -32
  102. checksums.yaml +0 -7
  103. data/lib/active_support/core_ext/cgi.rb +0 -1
  104. data/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -19
  105. data/lib/active_support/core_ext/object/returning.rb +0 -43
  106. data/lib/active_support/json/backends/jsongem.rb +0 -47
  107. data/lib/active_support/json/backends/okjson.rb +0 -644
  108. data/lib/active_support/json/backends/yajl.rb +0 -44
  109. data/lib/active_support/json/backends/yaml.rb +0 -19
  110. data/lib/active_support/testing/default.rb +0 -9
@@ -20,3 +20,11 @@ if RUBY_VERSION >= '1.9'
20
20
  end
21
21
  end
22
22
  end
23
+
24
+ module URI
25
+ class << self
26
+ def parser
27
+ @parser ||= URI.const_defined?(:Parser) ? URI::Parser.new : URI
28
+ end
29
+ end
30
+ end
@@ -5,6 +5,7 @@ require 'active_support/core_ext/module/aliasing'
5
5
  require 'active_support/core_ext/module/attribute_accessors'
6
6
  require 'active_support/core_ext/module/introspection'
7
7
  require 'active_support/core_ext/module/anonymous'
8
+ require 'active_support/core_ext/module/deprecation'
8
9
  require 'active_support/core_ext/object/blank'
9
10
  require 'active_support/core_ext/load_error'
10
11
  require 'active_support/core_ext/name_error'
@@ -47,9 +48,6 @@ module ActiveSupport #:nodoc:
47
48
  mattr_accessor :autoloaded_constants
48
49
  self.autoloaded_constants = []
49
50
 
50
- mattr_accessor :references
51
- self.references = {}
52
-
53
51
  # An array of constant names that need to be unloaded on every request. Used
54
52
  # to allow arbitrary constants to be marked for unloading.
55
53
  mattr_accessor :explicitly_unloadable_constants
@@ -64,8 +62,8 @@ module ActiveSupport #:nodoc:
64
62
  self.log_activity = false
65
63
 
66
64
  # The WatchStack keeps a stack of the modules being watched as files are loaded.
67
- # If a file in the process of being loaded (parent.rb) triggers the load of
68
- # another file (child.rb) the stack will ensure that child.rb handles the new
65
+ # If a file in the process of being loaded (parent.rb) triggers the load of
66
+ # another file (child.rb) the stack will ensure that child.rb handles the new
69
67
  # constants.
70
68
  #
71
69
  # If child.rb is being autoloaded, its constants will be added to
@@ -83,13 +81,13 @@ module ActiveSupport #:nodoc:
83
81
  super { |h,k| h[k] = [] }
84
82
  end
85
83
 
86
- # return a list of new constants found since the last call to watch_modules
84
+ # return a list of new constants found since the last call to watch_namespaces
87
85
  def new_constants
88
86
  constants = []
89
87
 
90
88
  # Grab the list of namespaces that we're looking for new constants under
91
89
  @watching.last.each do |namespace|
92
- # Retrieve the constants that were present under the namespace when watch_modules
90
+ # Retrieve the constants that were present under the namespace when watch_namespaces
93
91
  # was originally called
94
92
  original_constants = self[namespace].last
95
93
 
@@ -115,7 +113,7 @@ module ActiveSupport #:nodoc:
115
113
  end
116
114
  constants
117
115
  ensure
118
- # A call to new_constants is always called after a call to watch_modules
116
+ # A call to new_constants is always called after a call to watch_namespaces
119
117
  pop_modules(@watching.pop)
120
118
  end
121
119
 
@@ -166,7 +164,7 @@ module ActiveSupport #:nodoc:
166
164
  def const_missing(const_name, nesting = nil)
167
165
  klass_name = name.presence || "Object"
168
166
 
169
- if !nesting
167
+ unless nesting
170
168
  # We'll assume that the nesting of Foo::Bar is ["Foo::Bar", "Foo"]
171
169
  # even though it might not be, such as in the case of
172
170
  # class Foo::Bar; Baz; end
@@ -232,15 +230,11 @@ module ActiveSupport #:nodoc:
232
230
  end
233
231
 
234
232
  def load(file, *)
235
- result = false
236
- load_dependency(file) { result = super }
237
- result
233
+ load_dependency(file) { super }
238
234
  end
239
235
 
240
236
  def require(file, *)
241
- result = false
242
- load_dependency(file) { result = super }
243
- result
237
+ load_dependency(file) { super }
244
238
  end
245
239
 
246
240
  # Mark the given constant as unloadable. Unloadable constants are removed each
@@ -485,6 +479,10 @@ module ActiveSupport #:nodoc:
485
479
  qualified_name = qualified_name_for from_mod, const_name
486
480
  path_suffix = qualified_name.underscore
487
481
 
482
+ trace = caller.reject {|l| l =~ %r{#{Regexp.escape(__FILE__)}}}
483
+ name_error = NameError.new("uninitialized constant #{qualified_name}")
484
+ name_error.set_backtrace(trace)
485
+
488
486
  file_path = search_for_file(path_suffix)
489
487
 
490
488
  if file_path && ! loaded.include?(File.expand_path(file_path)) # We found a matching file to load
@@ -503,12 +501,11 @@ module ActiveSupport #:nodoc:
503
501
  return parent.const_missing(const_name)
504
502
  rescue NameError => e
505
503
  raise unless e.missing_name? qualified_name_for(parent, const_name)
504
+ raise name_error
506
505
  end
506
+ else
507
+ raise name_error
507
508
  end
508
-
509
- raise NameError,
510
- "uninitialized constant #{qualified_name}",
511
- caller.reject {|l| l.starts_with? __FILE__ }
512
509
  end
513
510
 
514
511
  # Remove the constants that have been autoloaded, and those that have been
@@ -516,7 +513,7 @@ module ActiveSupport #:nodoc:
516
513
  # to its class/module if it implements +before_remove_const+.
517
514
  #
518
515
  # The callback implementation should be restricted to cleaning up caches, etc.
519
- # as the enviroment will be in an inconsistent state, e.g. other constants
516
+ # as the environment will be in an inconsistent state, e.g. other constants
520
517
  # may have already been unloaded and not accessible.
521
518
  def remove_unloadable_constants!
522
519
  autoloaded_constants.each { |const| remove_constant const }
@@ -525,31 +522,76 @@ module ActiveSupport #:nodoc:
525
522
  explicitly_unloadable_constants.each { |const| remove_constant const }
526
523
  end
527
524
 
528
- class Reference
529
- @@constants = Hash.new { |h, k| h[k] = Inflector.constantize(k) }
525
+ class ClassCache
526
+ def initialize
527
+ @store = Hash.new { |h, k| h[k] = Inflector.constantize(k) }
528
+ end
529
+
530
+ def empty?
531
+ @store.empty?
532
+ end
533
+
534
+ def key?(key)
535
+ @store.key?(key)
536
+ end
537
+
538
+ def []=(key, value)
539
+ return unless key.respond_to?(:name)
540
+
541
+ raise(ArgumentError, 'anonymous classes cannot be cached') if key.name.blank?
542
+
543
+ @store[key.name] = value
544
+ end
545
+
546
+ def [](key)
547
+ key = key.name if key.respond_to?(:name)
548
+
549
+ @store[key]
550
+ end
551
+ alias :get :[]
552
+
553
+ class Getter # :nodoc:
554
+ def initialize(name)
555
+ @name = name
556
+ end
530
557
 
531
- attr_reader :name
558
+ def get
559
+ Reference.get @name
560
+ end
561
+ deprecate :get
562
+ end
532
563
 
533
- def initialize(name)
534
- @name = name.to_s
535
- @@constants[@name] = name if name.respond_to?(:name)
564
+ def new(name)
565
+ self[name] = name
566
+ Getter.new(name)
536
567
  end
568
+ deprecate :new
537
569
 
538
- def get
539
- @@constants[@name]
570
+ def store(name)
571
+ self[name] = name
572
+ self
540
573
  end
541
574
 
542
- def self.clear!
543
- @@constants.clear
575
+ def clear!
576
+ @store.clear
544
577
  end
545
578
  end
546
579
 
580
+ Reference = ClassCache.new
581
+
547
582
  def ref(name)
548
- references[name] ||= Reference.new(name)
583
+ Reference.new(name)
584
+ end
585
+ deprecate :ref
586
+
587
+ # Store a reference to a class +klass+.
588
+ def reference(klass)
589
+ Reference.store klass
549
590
  end
550
591
 
592
+ # Get the reference for class named +name+.
551
593
  def constantize(name)
552
- ref(name).get
594
+ Reference.get(name)
553
595
  end
554
596
 
555
597
  # Determine if the given constant has been automatically loaded.
@@ -609,6 +651,17 @@ module ActiveSupport #:nodoc:
609
651
  return []
610
652
  end
611
653
 
654
+ class LoadingModule #:nodoc:
655
+ # Old style environment.rb referenced this method directly. Please note, it doesn't
656
+ # actually *do* anything any more.
657
+ def self.root(*args)
658
+ if defined?(Rails) && Rails.logger
659
+ Rails.logger.warn "Your environment.rb uses the old syntax, it may not continue to work in future releases."
660
+ Rails.logger.warn "For upgrade instructions please see: http://manuals.rubyonrails.com/read/book/19"
661
+ end
662
+ end
663
+ end
664
+
612
665
  # Convert the provided const desc to a qualified constant name (as a string).
613
666
  # A module, class, symbol, or string may be provided.
614
667
  def to_constant_name(desc) #:nodoc:
@@ -631,7 +684,8 @@ module ActiveSupport #:nodoc:
631
684
  parent = Inflector.constantize(names * '::')
632
685
 
633
686
  log "removing constant #{const}"
634
- constantize(const).before_remove_const if constantize(const).respond_to?(:before_remove_const)
687
+ constantized = constantize(const)
688
+ constantized.before_remove_const if constantized.respond_to?(:before_remove_const)
635
689
  parent.instance_eval { remove_const to_remove }
636
690
 
637
691
  return true
@@ -639,7 +693,7 @@ module ActiveSupport #:nodoc:
639
693
 
640
694
  protected
641
695
  def log_call(*args)
642
- if logger && log_activity
696
+ if log_activity?
643
697
  arg_str = args.collect { |arg| arg.inspect } * ', '
644
698
  /in `([a-z_\?\!]+)'/ =~ caller(1).first
645
699
  selector = $1 || '<unknown>'
@@ -648,9 +702,11 @@ module ActiveSupport #:nodoc:
648
702
  end
649
703
 
650
704
  def log(msg)
651
- if logger && log_activity
652
- logger.debug "Dependencies: #{msg}"
653
- end
705
+ logger.debug "Dependencies: #{msg}" if log_activity?
706
+ end
707
+
708
+ def log_activity?
709
+ logger && log_activity
654
710
  end
655
711
  end
656
712
  end
@@ -4,12 +4,12 @@ require 'active_support/deprecation/method_wrappers'
4
4
  require 'active_support/deprecation/proxy_wrappers'
5
5
 
6
6
  module ActiveSupport
7
- module Deprecation #:nodoc:
7
+ module Deprecation
8
8
  class << self
9
9
  # The version the deprecated behavior will be removed, by default.
10
10
  attr_accessor :deprecation_horizon
11
11
  end
12
- self.deprecation_horizon = '3.0'
12
+ self.deprecation_horizon = '3.2'
13
13
 
14
14
  # By default, warnings are not silenced and debugging is off.
15
15
  self.silenced = false
@@ -7,10 +7,17 @@ module ActiveSupport
7
7
  # Whether to print a backtrace along with the warning.
8
8
  attr_accessor :debug
9
9
 
10
+ # Returns the set behaviour or if one isn't set, defaults to +:stderr+
10
11
  def behavior
11
12
  @behavior ||= [DEFAULT_BEHAVIORS[:stderr]]
12
13
  end
13
14
 
15
+ # Sets the behaviour to the specified value. Can be a single value or an array.
16
+ #
17
+ # Examples
18
+ #
19
+ # ActiveSupport::Deprecation.behavior = :stderr
20
+ # ActiveSupport::Deprecation.behavior = [:stderr, :log]
14
21
  def behavior=(behavior)
15
22
  @behavior = Array.wrap(behavior).map { |b| DEFAULT_BEHAVIORS[b] || b }
16
23
  end
@@ -58,7 +58,7 @@ module ActiveSupport
58
58
  end
59
59
  end
60
60
 
61
- class DeprecatedConstantProxy < DeprecationProxy #:nodoc:
61
+ class DeprecatedConstantProxy < DeprecationProxy #:nodoc:all
62
62
  def initialize(old_const, new_const)
63
63
  @old_const = old_const
64
64
  @new_const = new_const
@@ -3,6 +3,10 @@ module ActiveSupport
3
3
  class << self
4
4
  attr_accessor :silenced
5
5
 
6
+ # Outputs a deprecation warning to the output configured by <tt>ActiveSupport::Deprecation.behavior</tt>
7
+ #
8
+ # ActiveSupport::Deprecation.warn("something broke!")
9
+ # # => "DEPRECATION WARNING: something broke! (called from your_code.rb:1)"
6
10
  def warn(message = nil, callstack = caller)
7
11
  return if silenced
8
12
  deprecation_message(callstack, message).tap do |m|
@@ -80,6 +80,10 @@ module ActiveSupport
80
80
  parts.to_sentence(:locale => :en)
81
81
  end
82
82
 
83
+ def as_json(options = nil) #:nodoc:
84
+ to_i
85
+ end
86
+
83
87
  protected
84
88
 
85
89
  def sum(sign, time = ::Time.current) #:nodoc:
@@ -8,7 +8,7 @@ module ActiveSupport
8
8
  # I18n.reload!
9
9
  # end
10
10
  #
11
- # ActionDispatch::Callbacks.to_prepare do
11
+ # ActionDispatch::Reloader.to_prepare do
12
12
  # i18n_reloader.execute_if_updated
13
13
  # end
14
14
  #
@@ -0,0 +1,36 @@
1
+ module ActiveSupport
2
+ class FileWatcher
3
+ class Backend
4
+ def initialize(path, watcher)
5
+ @watcher = watcher
6
+ @path = path
7
+ end
8
+
9
+ def trigger(files)
10
+ @watcher.trigger(files)
11
+ end
12
+ end
13
+
14
+ def initialize
15
+ @regex_matchers = {}
16
+ end
17
+
18
+ def watch(pattern, &block)
19
+ @regex_matchers[pattern] = block
20
+ end
21
+
22
+ def trigger(files)
23
+ trigger_files = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = [] } }
24
+
25
+ files.each do |file, state|
26
+ @regex_matchers.each do |pattern, block|
27
+ trigger_files[block][state] << file if pattern === file
28
+ end
29
+ end
30
+
31
+ trigger_files.each do |block, payload|
32
+ block.call payload
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,6 +1,5 @@
1
1
  require 'zlib'
2
2
  require 'stringio'
3
- require 'active_support/core_ext/string/encoding'
4
3
 
5
4
  module ActiveSupport
6
5
  # A convenient wrapper for the zlib standard library that allows compression/decompression of strings with gzip.
@@ -1,7 +1,7 @@
1
1
  require 'active_support/core_ext/hash/keys'
2
2
 
3
3
  # This class has dubious semantics and we only have it so that
4
- # people can write params[:key] instead of params['key']
4
+ # people can write <tt>params[:key]</tt> instead of <tt>params['key']</tt>
5
5
  # and they get the same value for both keys.
6
6
 
7
7
  module ActiveSupport
@@ -28,7 +28,7 @@ module ActiveSupport
28
28
  end
29
29
 
30
30
  def self.new_from_hash_copying_default(hash)
31
- ActiveSupport::HashWithIndifferentAccess.new(hash).tap do |new_hash|
31
+ new(hash).tap do |new_hash|
32
32
  new_hash.default = hash.default
33
33
  end
34
34
  end
@@ -97,7 +97,9 @@ module ActiveSupport
97
97
 
98
98
  # Returns an exact copy of the hash.
99
99
  def dup
100
- HashWithIndifferentAccess.new(self)
100
+ self.class.new(self).tap do |new_hash|
101
+ new_hash.default = default
102
+ end
101
103
  end
102
104
 
103
105
  # Merges the instantized and the specified hashes together, giving precedence to the values from the second hash
@@ -107,7 +109,7 @@ module ActiveSupport
107
109
  end
108
110
 
109
111
  # Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
110
- # This overloaded definition prevents returning a regular hash, if reverse_merge is called on a HashWithDifferentAccess.
112
+ # This overloaded definition prevents returning a regular hash, if reverse_merge is called on a <tt>HashWithDifferentAccess</tt>.
111
113
  def reverse_merge(other_hash)
112
114
  super self.class.new_from_hash_copying_default(other_hash)
113
115
  end
@@ -7,4 +7,3 @@ rescue LoadError => e
7
7
  end
8
8
 
9
9
  I18n.load_path << "#{File.dirname(__FILE__)}/locale/en.yml"
10
- ActiveSupport.run_load_hooks(:i18n)
@@ -14,12 +14,12 @@ module I18n
14
14
  @reloader ||= ActiveSupport::FileUpdateChecker.new([]){ I18n.reload! }
15
15
  end
16
16
 
17
- # Add I18n::Railtie.reloader to ActionDispatch callbacks. Since, at this
17
+ # Add <tt>I18n::Railtie.reloader</tt> to ActionDispatch callbacks. Since, at this
18
18
  # point, no path was added to the reloader, I18n.reload! is not triggered
19
19
  # on to_prepare callbacks. This will only happen on the config.after_initialize
20
20
  # callback below.
21
21
  initializer "i18n.callbacks" do
22
- ActionDispatch::Callbacks.to_prepare do
22
+ ActionDispatch::Reloader.to_prepare do
23
23
  I18n::Railtie.reloader.execute_if_updated
24
24
  end
25
25
  end
@@ -96,7 +96,7 @@ module ActiveSupport
96
96
  def clear(scope = :all)
97
97
  case scope
98
98
  when :all
99
- @plurals, @singulars, @uncountables = [], [], []
99
+ @plurals, @singulars, @uncountables, @humans = [], [], [], []
100
100
  else
101
101
  instance_variable_set "@#{scope}", []
102
102
  end