Skip to content

Commit 20403f6

Browse files
authored
Merge pull request #127 from Bonias/fix-problem-with-rails-reloading
Fix problem with code reloading
2 parents 6541122 + e355063 commit 20403f6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/lit/cache.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,14 @@ def delete_key(key)
115115
I18n.backend.reload!
116116
end
117117

118-
def reset
118+
def reset_local_cache
119119
@locale_cache = {}
120120
@localization_key_object_cache = {}
121121
@localization_object_cache = {}
122+
end
123+
124+
def reset
125+
reset_local_cache
122126
localizations.clear
123127
localization_keys.clear
124128
load_all_translations

lib/lit/engine.rb

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ class Engine < ::Rails::Engine
1717
end
1818
end
1919

20+
initializer 'lit.reloader' do |app|
21+
config.to_prepare do
22+
Lit.loader.cache.reset_local_cache if Lit.loader
23+
end
24+
end
25+
2026
initializer 'lit.migrations.append' do |app|
2127
unless app.root.to_s.include?(root.to_s)
2228
config.paths['db/migrate'].expanded.each do |expanded_path|

0 commit comments

Comments
 (0)