Sha256: 0c22654c0fbd8b2c78979bcc86844b35031d60538f4c221a4fc4bfca079d039a

Contents?: true

Size: 915 Bytes

Versions: 13

Compression:

Stored size: 915 Bytes

Contents

module Neo4j
	module Rails
		module Serialization
			extend ActiveSupport::Concern
			
			included do
				include ActiveModel::Serializers::Xml
				
				# Patch for ActiveModel's XML serializer.  There is a bug in the original where
				# raw_value is used in the initializer and so demands always that the object being 
				# serialized is sent the attribute's name as a method call.  This causes a problem
				# for Neo4j properties that aren't declared and so don't have methods to call.  Besides
				# which it's not necessary to re-call to get the value again if it has already
				# been passed.
				class ActiveModel::Serializers::Xml::Serializer::Attribute
					def initialize(name, serializable, raw_value=nil)
            @name, @serializable = name, serializable
            @value = raw_value || @serializable.send(name)
            @type  = compute_type
          end
        end
			end
		end
	end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
neo4j-1.0.0-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.32-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.31-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.30-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.29-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.28-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.27-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.26-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.25-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.24-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.23-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.22-java lib/neo4j/rails/serialization.rb
neo4j-1.0.0.beta.21-java lib/neo4j/rails/serialization.rb