make serialization_context available in link#1976
Closed
f-mer wants to merge 2 commits intorails-api:masterfrom
f-mer:master
Closed
make serialization_context available in link#1976f-mer wants to merge 2 commits intorails-api:masterfrom f-mer:master
f-mer wants to merge 2 commits intorails-api:masterfrom
f-mer:master
Conversation
bf4
reviewed
Nov 17, 2016
| # actionpack-4.0.13/lib/action_dispatch/routing/route_set.rb:417: warning: instance variable @_routes not initialized | ||
| @object = serializer.object | ||
| @scope = serializer.scope | ||
| @context = adapter_options[:serialization_context] |
Member
There was a problem hiding this comment.
any reason you can't use the scope?
bf4
reviewed
Nov 27, 2016
| def links_for(serializer) | ||
| serializer._links.each_with_object({}) do |(name, value), hash| | ||
| result = Link.new(serializer, value).as_json | ||
| result = Link.new(serializer, value, instance_options).as_json |
Member
There was a problem hiding this comment.
should probably mirror usage in pagination links?
- https://github.com/f-mer/active_model_serializers/blob/a6a8f53cadc1205b19f0ead41ab5c3f2d03bed10/lib/active_model_serializers/adapter/json_api/pagination_links.rb
- https://github.com/f-mer/active_model_serializers/blob/a6a8f53cadc1205b19f0ead41ab5c3f2d03bed10/lib/active_model_serializers/adapter/json_api.rb#L507
Author
|
Thanks for getting back at this! Yep that was the idea. render json: @resources, scope: view_context, scope_name: :view_contextLinks could be build like this: link :self do
view_context.api_resource_url(object)
endand the |
Member
Author
|
Closing this pull request because |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Makes it possible to build urls of engines with isolated namespace by passing the
ActionDispatch::Routing::RoutesProxy(my_engine).Changes
Pass serialization_context to link.