Sha256: fcaab33362ca8b607e6f5930e1eff959079bf02e1d365fdb2e485233912102a2
Contents?: true
Size: 1.15 KB
Versions: 11
Compression:
Stored size: 1.15 KB
Contents
require 'active_support/core_ext/array/extract_options' module ActiveModelSerializers class SerializationContext class << self attr_writer :url_helpers, :default_url_options def url_helpers @url_helpers ||= Module.new end def default_url_options @default_url_options ||= {} end end module UrlHelpers def self.included(base) base.send(:include, SerializationContext.url_helpers) end def default_url_options SerializationContext.default_url_options end end attr_reader :request_url, :query_parameters, :key_transform def initialize(*args) options = args.extract_options! if args.size == 1 request = args.pop options[:request_url] = request.original_url[/\A[^?]+/] options[:query_parameters] = request.query_parameters end @request_url = options.delete(:request_url) @query_parameters = options.delete(:query_parameters) @url_helpers = options.delete(:url_helpers) || self.class.url_helpers @default_url_options = options.delete(:default_url_options) || self.class.default_url_options end end end
Version data entries
11 entries across 11 versions & 2 rubygems