Skip to content

Instantly share code, notes, and snippets.

@wapcaplet
Created March 9, 2012 17:50
Show Gist options
  • Save wapcaplet/2007742 to your computer and use it in GitHub Desktop.
Save wapcaplet/2007742 to your computer and use it in GitHub Desktop.
describe "pages vs. outgoing(:pages)" do
it "isn't the same thing" do
Neo4j::Transaction.run do
puts "@uri_node.pages: #{@uri_node.pages.inspect}"
puts "@uri_node.outgoing(:pages): #{@uri_node.outgoing(:pages).inspect}"
puts
puts "Appending a page to @uri_node.pages..."
page = Page.new(:name => 'mypage')
@uri_node.pages << page
puts
puts "After appending:"
puts "@uri_node.pages.count: #{@uri_node.pages.count}"
puts "@uri_node.outgoing(:pages).count: #{@uri_node.outgoing(:pages).count}"
end
end
end
# Output:
@uri_node.pages: #<Neo4j::HasN::Mapping:0x2af590c6 @node=#<SHRM::CMS::URINode:0x456c9182 @_java_node=#<#<Class:0x2b8535cb>:0x76a0416a>>, @dsl=#<Neo4j::HasN::DeclRelationshipDsl:0x3ffa330d @relationship=SHRM::NeoUtils::Delta, @has_one=false, @target_class=SHRM::CMS::Page, @dir=:outgoing, @rel_type="SHRM::CMS::Page#pages", @method_id=:pages>>
@uri_node.outgoing(:pages): #<Neo4j::Traversal::Traverser:0x70ccb7e0 @depth=1, @td=#<Java::OrgNeo4jKernelImplTraversal::TraversalDescriptionImpl:0x38862c65>, @dir=#<Java::OrgNeo4jGraphdb::Direction:0x6bfd472>, @type=#<Java::OrgNeo4jGraphdb::DynamicRelationshipType:0x1da477bf>, @from=#<#<Class:0x2b8535cb>:0x76a0416a>>
Appending a page to @uri_node.pages...
After appending:
@uri_node.pages.count: 1
@uri_node.outgoing(:pages).count: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment