-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Grape::Extensions::Hashie::Mash::ParamBuilder can't be set as a default globally in 1 place #1775
Comments
So technically modifying 200 files works, right? You can introduce a class in the middle and then inherit from it maybe, but you'll still need to modify 200 files. Since it's a bulk search/replace, why is that not an acceptable solution? Quick and dirty, you can probably monkey-patch Feel free to PR a better solution to set this globally. |
FYI this was introduced in #1610. I renamed this into a feature request to allow one to set the param builder globally, without an |
Thank you @dblock that's awesome! |
reopening since it's still a valid feature |
I think this can be closed now. Apologise for the original confusion when creating this issue |
Context: I'm upgrading a massive rails 3.2 API to rails 4. I'm late to the party to realise that Grape changed the default param builder.
Problem: The proposed solution for backwards compatibility:
include Grape::Extensions::Hashie::Mash::ParamBuilder
can't be applied globally as far as I could investigate.The reason for concern is that we have over 200+ API endpoints, and I'd rather not have to modify the 200 files just for the sake of maintaining backwards compatibility.
Is there anyway of setting this builder as the default builder for Grape? Just re-opening Grape::API or building a custom parent class that included
Grape::Extensions::Hashie::Mash::ParamBuilder
didn't cut it for me.Using the
def self.inherited(base)
base.include Grape::Extensions::Hashie::Mash::ParamBuilder
end
didn't help either, as in some of our API's the routes hadn't been loaded by then causing some trouble.
Perhaps you've though of an approach, or a new approach must be made?
Thanks in advance for the help
The text was updated successfully, but these errors were encountered: