Sha256: 0f36ca370c764c56eba21fc1cdb14ac9679fa3d68a473f9c0d1558a4d0d94ea7

Contents?: true

Size: 730 Bytes

Versions: 19

Compression:

Stored size: 730 Bytes

Contents

module FunWithJsonApi
  module ActionControllerExtensions
    module Serialization
      # Overrides the dynamic render json_api methods to use ActiveModelSerializer
      [:_render_option_json_api, :_render_with_renderer_json_api].each do |renderer_method|
        define_method renderer_method do |resource, options|
          options.fetch(:adapter) { options[:adapter] ||= :json_api }
          options.fetch(:serialization_context) do
            options[:serialization_context] ||=
              ActiveModelSerializers::SerializationContext.new(request)
          end
          serializable_resource = get_serializer(resource, options)
          super(serializable_resource, options)
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
fun_with_json_api-0.0.11.1 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.11 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.10.4 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.10.3 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.10.2 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.10.1 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.10 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.9 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.8.2 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.8.1 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.8 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.7 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.6.pre.alpha.2 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.6.pre.alpha.1 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.6.1 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.6 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.5 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.4 lib/fun_with_json_api/action_controller_extensions/serialization.rb
fun_with_json_api-0.0.3 lib/fun_with_json_api/action_controller_extensions/serialization.rb