Skip to content

Instantly share code, notes, and snippets.

@wapcaplet
Created March 28, 2012 22:13
Show Gist options
  • Save wapcaplet/2231007 to your computer and use it in GitHub Desktop.
Save wapcaplet/2231007 to your computer and use it in GitHub Desktop.
# Return default values for important properties
def self.defaults
{
:status => 'active',
:root => URINode.new(:name => '__root__'),
:taxonomy => TaxonomyNode.new(:name => '__taxonomy__'),
}
end
def init_on_create(*args)
# Merge keyword arguments with defaults
if args[0].respond_to?(:each_pair)
super(self.class.defaults.merge(args[0]), *args[1..-1])
else
super(*args)
end
Neo4j.ref_node.outgoing(:websites) << self
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment