Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.0.51 to 0.1.2 self-referential relationship breaks #15

Open
curlyice opened this issue Jan 15, 2013 · 1 comment
Open

0.0.51 to 0.1.2 self-referential relationship breaks #15

curlyice opened this issue Jan 15, 2013 · 1 comment
Labels

Comments

@curlyice
Copy link

When I upgraded I began experiencing an issue with a self-referential relationship where in the relationship in my Postgres database would appear, but would not in Neo4j.

class User < ActiveRecord::Base
  has_secure_password
  attr_accessible :bio, :email, :first_name, :last_name, :password, :password_confirmation

  include Neoid::Node
  has_many :follows
  has_many :reverse_follows, foreign_key: :following_id, class_name: "Follow"
  has_many :followers, through: :reverse_follows, source: :user
  has_many :followings, through: :follows
end

class Follow < ActiveRecord::Base
  include Neoid::Relationship
  attr_accessible :user_id, :following_id
  belongs_to :following, class_name: "User"
  belongs_to :user

  neoidable do |c|
    c.relationship start_node: :user, end_node: :following, type: :follows
  end
end

To recreate:

  1. create a user1 and a user2
  2. user1.followings << user2
  3. save user1
  4. user2.followings << user1
  5. save user2

In 0.0.51 this behaves as expected:
Screen Shot 2013-01-15 at 12 12 35 PM

In 0.1.2 only one relationship is created:
Screen Shot 2013-01-15 at 12 25 20 PM

I've tried it with per model indexing both on and off, just to be sure, with the same result. Is there some other change I'm missing?

Also; this might not be the appropriate place for this, but thanks a million for your work elado.

@BenMorganIO
Copy link
Contributor

Can you provide me the version of Neo4j that you are using?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants