Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 03a6d07

Browse files
committed
Cache run_config on first reference
Only compute run_config on the first call, so that it can be inspected and modified by the application initializers.
1 parent ec67111 commit 03a6d07

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/requirejs/rails/config.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ def build_config
114114
end
115115

116116
def run_config
117-
run_config = { "baseUrl" => "/assets" }
118-
run_config.merge!(self.user_config).slice(*self.run_config_whitelist)
117+
unless self.has_key(:run_config)
118+
self[:run_config] = { "baseUrl" => "/assets" }
119+
self[:run_config].merge!(self.user_config).slice!(*self.run_config_whitelist)
120+
end
121+
self[:run_config]
119122
end
120123

121124
def user_config=(cfg)

0 commit comments

Comments
 (0)