Skip to content
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

Call super in API.inherited #2180

Merged

Conversation

yogeshjain999
Copy link
Contributor

API.make_inheritable was overriding .inherited hook on given instance itself. But it was not calling super which is required to bubble up the inheritance chain.

This PR removes .make_inheritable and calls super instead.

Fixes PR with reproducible spec #2179.

`API.make_inheritable` was overriding `.inherited` hook on given
instance itself. But it was not calling `super` which is required to
bubble up inheritance chain.

This commit removes `.make_inheritable` and calls `super` instead.

Fixes PR with reproducible spec ruby-grape#2179.
@@ -68,15 +69,6 @@ def call(*args, &block)
instance_for_rack.call(*args, &block)
end

# Allows an API to itself be inheritable:
def make_inheritable(api)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? Couldn't we just call super in #inherited and leave the rest as it is? 🍻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling this method with super was creating warnings about method redefinations as override_all_methods! gets called twice.

I guess make_inheritable was defined in order to pass extra argument, instead of super.

@dblock
Copy link
Member

dblock commented Jul 12, 2021

Given that tests are passing I'm inclined to merge this. WDYT @apotonick (and thanks for jumping in to review!)?

@apotonick
Copy link

Now looking great! We need this super call to hook into your inheritance in trb-endpoint, since we want to support the winning HTTP framework! 🏆 🍻

@dblock dblock merged commit a20bcb1 into ruby-grape:master Jul 13, 2021
@yogeshjain999 yogeshjain999 deleted the fix/overriding-api-inherited branch July 14, 2021 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants