mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Revert "rename context to serialization_context and add url helpers"
This commit is contained in:
@@ -206,7 +206,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def links_for(serializer, options)
|
||||
JsonApi::PaginationLinks.new(serializer.object, options[:serialization_context]).serializable_hash(options)
|
||||
JsonApi::PaginationLinks.new(serializer.object, options[:context]).serializable_hash(options)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -41,11 +41,11 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def url(options)
|
||||
@url ||= options.fetch(:links, {}).fetch(:self, nil) || request_url
|
||||
@url ||= options.fetch(:links, {}).fetch(:self, nil) || original_url
|
||||
end
|
||||
|
||||
def request_url
|
||||
@request_url ||= context.request_url
|
||||
def original_url
|
||||
@original_url ||= context.original_url[/\A[^?]+/]
|
||||
end
|
||||
|
||||
def query_parameters
|
||||
|
||||
@@ -7,18 +7,6 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
|
||||
initializer 'active_model_serializers.url_helpers' do
|
||||
ActiveSupport.on_load(:action_controller) do
|
||||
ActiveModelSerializers.url_helpers = Module.new do
|
||||
include Rails.application.routes.url_helpers
|
||||
|
||||
def self.default_url_options
|
||||
ActionController::Base.default_url_options
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initializer 'generators' do |app|
|
||||
app.load_generators
|
||||
require 'generators/serializer/resource_override'
|
||||
|
||||
Reference in New Issue
Block a user