Skip to content

Commit 7eb8f26

Browse files
authored
Merge pull request #555 from husteadrobert/run_configure_after_initialize_on_rails
Check to see if being run in Rails application and run in before_initialize
2 parents d669bcc + df74e2a commit 7eb8f26

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/split.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,11 @@ def configure
6666
end
6767
end
6868

69-
Split.configure {}
69+
# Check to see if being run in a Rails application. If so, wait until before_initialize to run configuration so Gems that create ENV variables have the chance to initialize first.
70+
if defined?(::Rails)
71+
class Railtie < Rails::Railtie
72+
config.before_initialize { Split.configure {} }
73+
end
74+
else
75+
Split.configure {}
76+
end

0 commit comments

Comments
 (0)