-
Notifications
You must be signed in to change notification settings - Fork 68
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
Pass adapter options through calls to render. #63
Conversation
c26577b
to
2a98c3c
Compare
I like it. It needs a README update please and a rebase. |
Great! I've updated the README. Let me know if you have any other suggestions |
Thinking about this more, help me understand what's going on. Now all options get merged into |
Hey @dblock, sorry for the late reply. The intention there was to not have the meta options pollute the main option pool. Ideally the ams_adapter_options would only be the subset of options explicitly used by AMS adapters, however I took a shortcut here and merged them all in. I'll check into the internals of AMS and then look for a list of options and whitelist the options that can be passed along in ams_adapter_options. Would that solve your concerns? |
Okay @dblock - I've pushed up another commit that both explicitly whitelists the adapter options that are passed along as well as adds support for optionally defined extra options. Let me know what you think |
def render(resources, meta = {}) | ||
env['ams_meta'] = meta | ||
def render(resources, extra_options = {}) | ||
extra_options.symbolize_keys! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're modifying the value passed in. You shouldn't. At least dup
them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This is a lot better. I have some minor-ish concerns above, will merge after those are fixed. |
Okay! @dblock - I've addressed your comments. Thanks for the review! |
Merged. |
Hey @drn interested in helping out with this gem? Maybe making a release? |
This allows for functionality like this:
the only way to pass adapter options was via route_options, which doesn't work if we need to programmatically switch on any of the options (esp because they are cached in between requests as noted here ruby-grape/grape#918)