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.
- data/CHANGELOG +14 -66
- data/README.rdoc +1 -1
- data/lib/active_support/backtrace_cleaner.rb +1 -1
- data/lib/active_support/buffered_logger.rb +4 -11
- data/lib/active_support/cache.rb +12 -15
- data/lib/active_support/cache/file_store.rb +3 -2
- data/lib/active_support/cache/mem_cache_store.rb +11 -3
- data/lib/active_support/cache/strategy/local_cache.rb +28 -23
- data/lib/active_support/callbacks.rb +195 -175
- data/lib/active_support/concern.rb +105 -35
- data/lib/active_support/configurable.rb +41 -2
- data/lib/active_support/core_ext/array/access.rb +2 -2
- data/lib/active_support/core_ext/array/random_access.rb +10 -7
- data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -2
- data/lib/active_support/core_ext/class/attribute.rb +27 -17
- data/lib/active_support/core_ext/class/inheritable_attributes.rb +12 -86
- data/lib/active_support/core_ext/class/subclasses.rb +20 -34
- data/lib/active_support/core_ext/date/calculations.rb +14 -2
- data/lib/active_support/core_ext/date/conversions.rb +6 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +26 -9
- data/lib/active_support/core_ext/date_time/conversions.rb +1 -1
- data/lib/active_support/core_ext/date_time/zones.rb +1 -1
- data/lib/active_support/core_ext/enumerable.rb +2 -5
- data/lib/active_support/core_ext/float/rounding.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +1 -0
- data/lib/active_support/core_ext/hash/conversions.rb +23 -36
- data/lib/active_support/core_ext/hash/deep_dup.rb +11 -0
- data/lib/active_support/core_ext/hash/keys.rb +6 -4
- data/lib/active_support/core_ext/hash/reverse_merge.rb +9 -14
- data/lib/active_support/core_ext/kernel/reporting.rb +19 -0
- data/lib/active_support/core_ext/logger.rb +11 -38
- data/lib/active_support/core_ext/module/attr_accessor_with_default.rb +11 -12
- data/lib/active_support/core_ext/module/attr_internal.rb +13 -6
- data/lib/active_support/core_ext/module/deprecation.rb +2 -0
- data/lib/active_support/core_ext/object.rb +1 -1
- data/lib/active_support/core_ext/object/blank.rb +42 -9
- data/lib/active_support/core_ext/object/duplicable.rb +48 -9
- data/lib/active_support/core_ext/object/inclusion.rb +15 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +1 -35
- data/lib/active_support/core_ext/object/to_param.rb +13 -8
- data/lib/active_support/core_ext/object/to_query.rb +2 -2
- data/lib/active_support/core_ext/object/try.rb +27 -10
- data/lib/active_support/core_ext/object/with_options.rb +19 -5
- data/lib/active_support/core_ext/range.rb +1 -0
- data/lib/active_support/core_ext/range/cover.rb +3 -0
- data/lib/active_support/core_ext/string.rb +1 -0
- data/lib/active_support/core_ext/string/filters.rb +3 -3
- data/lib/active_support/core_ext/string/inflections.rb +1 -1
- data/lib/active_support/core_ext/string/inquiry.rb +13 -0
- data/lib/active_support/core_ext/string/multibyte.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +33 -89
- data/lib/active_support/core_ext/time/calculations.rb +14 -13
- data/lib/active_support/core_ext/time/conversions.rb +2 -24
- data/lib/active_support/core_ext/time/marshal.rb +0 -1
- data/lib/active_support/core_ext/time/zones.rb +32 -21
- data/lib/active_support/core_ext/uri.rb +8 -0
- data/lib/active_support/dependencies.rb +93 -37
- data/lib/active_support/deprecation.rb +2 -2
- data/lib/active_support/deprecation/behaviors.rb +7 -0
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/deprecation/reporting.rb +4 -0
- data/lib/active_support/duration.rb +4 -0
- data/lib/active_support/file_update_checker.rb +1 -1
- data/lib/active_support/file_watcher.rb +36 -0
- data/lib/active_support/gzip.rb +0 -1
- data/lib/active_support/hash_with_indifferent_access.rb +6 -4
- data/lib/active_support/i18n.rb +0 -1
- data/lib/active_support/i18n_railtie.rb +2 -2
- data/lib/active_support/inflector/inflections.rb +1 -1
- data/lib/active_support/json/decoding.rb +37 -23
- data/lib/active_support/json/encoding.rb +8 -3
- data/lib/active_support/lazy_load_hooks.rb +7 -7
- data/lib/active_support/log_subscriber.rb +3 -3
- data/lib/active_support/log_subscriber/test_helper.rb +4 -3
- data/lib/active_support/message_encryptor.rb +1 -1
- data/lib/active_support/message_verifier.rb +1 -1
- data/lib/active_support/multibyte/chars.rb +4 -3
- data/lib/active_support/multibyte/unicode.rb +1 -1
- data/lib/active_support/notifications.rb +9 -8
- data/lib/active_support/notifications/fanout.rb +3 -3
- data/lib/active_support/ordered_hash.rb +19 -2
- data/lib/active_support/ordered_options.rb +33 -3
- data/lib/active_support/railtie.rb +1 -1
- data/lib/active_support/rescuable.rb +1 -0
- data/lib/active_support/secure_random.rb +11 -5
- data/lib/active_support/test_case.rb +2 -10
- data/lib/active_support/testing/assertions.rb +17 -6
- data/lib/active_support/testing/mochaing.rb +7 -0
- data/lib/active_support/testing/pending.rb +27 -23
- data/lib/active_support/testing/setup_and_teardown.rb +8 -11
- data/lib/active_support/time_with_zone.rb +6 -3
- data/lib/active_support/version.rb +3 -3
- data/lib/active_support/whiny_nil.rb +1 -1
- data/lib/active_support/xml_mini.rb +4 -2
- data/lib/active_support/xml_mini/jdom.rb +9 -16
- data/lib/active_support/xml_mini/libxml.rb +1 -0
- data/lib/active_support/xml_mini/libxmlsax.rb +2 -1
- data/lib/active_support/xml_mini/nokogiri.rb +1 -0
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -0
- data/lib/active_support/xml_mini/rexml.rb +1 -0
- metadata +50 -32
- checksums.yaml +0 -7
- data/lib/active_support/core_ext/cgi.rb +0 -1
- data/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +0 -19
- data/lib/active_support/core_ext/object/returning.rb +0 -43
- data/lib/active_support/json/backends/jsongem.rb +0 -47
- data/lib/active_support/json/backends/okjson.rb +0 -644
- data/lib/active_support/json/backends/yajl.rb +0 -44
- data/lib/active_support/json/backends/yaml.rb +0 -19
- data/lib/active_support/testing/default.rb +0 -9
@@ -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
|
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
|
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
|
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
|
-
|
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
|
-
|
236
|
-
load_dependency(file) { result = super }
|
237
|
-
result
|
233
|
+
load_dependency(file) { super }
|
238
234
|
end
|
239
235
|
|
240
236
|
def require(file, *)
|
241
|
-
|
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
|
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
|
529
|
-
|
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
|
-
|
558
|
+
def get
|
559
|
+
Reference.get @name
|
560
|
+
end
|
561
|
+
deprecate :get
|
562
|
+
end
|
532
563
|
|
533
|
-
def
|
534
|
-
|
535
|
-
|
564
|
+
def new(name)
|
565
|
+
self[name] = name
|
566
|
+
Getter.new(name)
|
536
567
|
end
|
568
|
+
deprecate :new
|
537
569
|
|
538
|
-
def
|
539
|
-
|
570
|
+
def store(name)
|
571
|
+
self[name] = name
|
572
|
+
self
|
540
573
|
end
|
541
574
|
|
542
|
-
def
|
543
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
652
|
-
|
653
|
-
|
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
|
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.
|
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
|
@@ -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|
|
@@ -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
|
data/lib/active_support/gzip.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
data/lib/active_support/i18n.rb
CHANGED
@@ -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::
|
22
|
+
ActionDispatch::Reloader.to_prepare do
|
23
23
|
I18n::Railtie.reloader.execute_if_updated
|
24
24
|
end
|
25
25
|
end
|