Merge pull request #1289 from tchak/serialization_context

rename context to serialization_context and add url helpers
This commit is contained in:
L. Preston Sego III
2015-10-29 07:56:47 -04:00
7 changed files with 35 additions and 7 deletions

View File

@@ -206,7 +206,7 @@ module ActiveModel
end
def links_for(serializer, options)
JsonApi::PaginationLinks.new(serializer.object, options[:context]).serializable_hash(options)
JsonApi::PaginationLinks.new(serializer.object, options[:serialization_context]).serializable_hash(options)
end
end
end

View File

@@ -41,11 +41,11 @@ module ActiveModel
end
def url(options)
@url ||= options.fetch(:links, {}).fetch(:self, nil) || original_url
@url ||= options.fetch(:links, {}).fetch(:self, nil) || request_url
end
def original_url
@original_url ||= context.original_url[/\A[^?]+/]
def request_url
@request_url ||= context.request_url
end
def query_parameters