Sha256: 8466a62c18d21d8cf9e672e03c7f5210727865b09bc8e41924ce17b95047b2ff

Contents?: true

Size: 1.01 KB

Versions: 6

Compression:

Stored size: 1.01 KB

Contents

## http://matthewrobertson.org/blog/2013/08/06/active-record-serializers-from-scratch/
#
#if Rails::VERSION::STRING.split('.').first.to_i < 4
#	require 'active_record/serializer_override'
#end
#
#def app_serialize(aObject,aScope)
#	result = case aObject.class
#		when Fixnum then aObject.to_s
#		when Bignum then aObject.to_s
#		when Array
#			sz_class = ActiveModel::ArraySerializer
#			sz_class.new(aObject).to_json(:scope => aScope, :root => false)
#		when String then aObject
#		when FalseClass then 'false'
#		when TrueClass then 'true'
#		when Symbol then aObject.to_s
#		#when Hash
#			#sz_class = ActiveModel::Serializer
#			#sz_class.new(aObject).to_json(:scope => aScope, :root => false)
#		else
#			sz_class = aObject.respond_to?(:active_model_serializer) && aObject.send(:active_model_serializer)
#			sz_class = DefaultKojacSerializer if !sz_class && aObject.is_a?(ActiveModel)
#			if sz_class
#				sz_class.new(aObject).to_json(:scope => aScope, :root => false)
#			else
#				aObject.to_json
#			end
#	end
#	result
#end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kojac-0.17.0 lib/kojac/app_serialize.rb
kojac-0.16.0 lib/kojac/app_serialize.rb
kojac-0.15.0 lib/kojac/app_serialize.rb
kojac-0.13.0 lib/kojac/app_serialize.rb
kojac-0.12.0 lib/kojac/app_serialize.rb
kojac-0.11.0 lib/kojac/app_serialize.rb