A simple question

3 views
Skip to first unread message

lordkada

unread,
Sep 22, 2011, 5:26:39 AM9/22/11
to neo4jrb
Hi,

when I use this syntax:

has_n( :authored ).to( TopicNode ).relationship( Authored )

to define a new relationship, it seems that its initialization method
( 'Authored.init_on_create' ) is not invoked (I need it to setup some
attributes, such as the date of the creation of the relationship)

Where am I wrong?

Any suggestion is welcome!

Thanks in advance

CA

Andreas Ronge

unread,
Sep 22, 2011, 5:34:32 AM9/22/11
to neo...@googlegroups.com
Hi

Are you using the Neo4j::NodeMixin or the Neo4j::Rails::Model and
Neo4j::Rails::Relationship classes ?
What does your TopicNode and Authored classes look like ?

/Andreas

> --
> You received this message because you are subscribed to the Google Groups "neo4jrb" group.
> To post to this group, send email to neo...@googlegroups.com.
> To unsubscribe from this group, send email to neo4jrb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/neo4jrb?hl=en.
>
>

lordkada

unread,
Sep 22, 2011, 5:44:47 AM9/22/11
to neo4jrb
Andreas,

my classes are:

UserNode.rb
~~~~~~~~~~~
class UserNode

include Neo4j::NodeMixin

has_n( :authored ).to( TopicNode ).relationship( Authored )

end

TopicNode.rb
~~~~~~~~~~~~
class TopicNode

include Neo4j::NodeMixin

end

Authored.rb
~~~~~~~~~~~
class Authored

include Neo4j::RelationshipMixin

property :ts, :type => DateTime

def init_on_create *args

p "I cannot see this output!"
# or any init code...

end

end

Btw, the relationship is built... my problem is just the
init_on_create callback

Ciao,

CA

Andreas Ronge

unread,
Sep 22, 2011, 6:31:26 AM9/22/11
to neo...@googlegroups.com

lordkada

unread,
Sep 22, 2011, 6:39:07 AM9/22/11
to neo4jrb
ok,

thanks!

Ciao,

CA

On Sep 22, 3:31 am, Andreas Ronge <andreas.ro...@gmail.com> wrote:
> It's a bug, seehttp://neo4j.lighthouseapp.com/projects/15548-neo4j/tickets/183-init_...
Reply all
Reply to author
Forward
0 new messages