-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix undefined method `DelegateClass' for Rack::Session::Cookie:Class #1610
Fix undefined method `DelegateClass' for Rack::Session::Cookie:Class #1610
Conversation
While adding the delegate require does fix the problem, accepting this will lead to the slippery slope of adding such internal requires for all deep requires of rack. That is something we are trying to avoid starting in Rack 2.2. As stated in the release notes for 2.2.0, under Changed:
If you change your require to be "rack" instead of "rack/session/cookie", that will solve the problem. That is the recommended way going forward. While this particular issue was not expected, it was expected there would some fallout from the change to rely more heavily on autoload. I'm not going to close this immediately, I would like to get some feedback from other members of the core team first. |
I think individual files should pull in relevant dependencies, and as such I would accept a PR to fix this. Personally, I think autoload is tangential to this issue, as that is about loading files relative to |
@ioquatix Just to confirm, you are OK with this PR because the require is for a stdlib library, but you wouldn't be OK with adding a require for |
How would this fix it?
Since |
|
Yep, @tenderlove is correct. When I originally tested this, it appeared to work with just requiring rack, but my testing was broken. I'll merge this now. |
Thank you!! 🙌 |
Do we want to back port this or does it not matter? |
I think it is a candidate for 2.2.3. However, the workaround is fairly simple, so I don't feel strongly about it. |
* Bump gems * Bump ruby version for coverage ## To make a commit, type your commit message and press SUPER-ENTER. ## To cancel the commit, close the window. To sign off on the commit, ## press SUPER-S. ## ## You may also reference or close a GitHub issue with this commit. ## To do so, type `#` followed by the `tab` key. You will be shown a ## list of issues related to the current repo. You may also type ## `owner/repo#` plus the `tab` key to reference an issue in a ## different GitHub repo. spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 15d8d26..6a7140b 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,7 +2,7 @@ require "bundler/setup" -if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.5" && RUBY_VERSION < "2.6" +if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.6" && RUBY_VERSION < "2.7" require "simplecov" unless %w[false 0].include?(ENV["COV"]) begin * Fallback to UNIQUE_KEY * Fix console spec * Mandatory rubocop commit * Due to bug in rack rack/rack#1610 * Fix broken spec * Da fork jRuby...? * Skip spec for jruby * sodsohdoasdhifa;sodb ;oqwuefg2398yr 2t89f ouwefqo
Summary
Rack::Session::Cookie requires
require 'delegate'
Test Repository: https://github.com/onigra/rack-undefined-method-delegate-class
Environment
Before
After