From 3c8a798ed5e702e405ab3147a39d8862c18a1e9b Mon Sep 17 00:00:00 2001 From: Joel Lubrano Date: Tue, 10 Sep 2019 16:57:04 -0400 Subject: [PATCH] Add comment explaining the cautious use of Rails.application.class.module_parent --- lib/stitches/api_key.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/stitches/api_key.rb b/lib/stitches/api_key.rb index 04b2af8..9081c8a 100644 --- a/lib/stitches/api_key.rb +++ b/lib/stitches/api_key.rb @@ -57,6 +57,11 @@ def do_call(env) private + # TODO: (jdlubrano) + # Once Rails 5 support is no longer necessary, we can simply call + # Rails.application.class.module_parent. The module_parent method + # does not exist in Rails <= 5, though, so we need to gracefully fallback + # Rails.application.class.parent for Rails versions predating Rails 6.0.0. def rails_app_module application_class = Rails.application.class parent = application_class.try(:module_parent) || application_class.parent