masciugo / genealogy

Make ActiveRecord model act as a pedigree
MIT License
30 stars 17 forks source link

Expected User object. Got Array while adding siblings. #19

Open mukeshsinghr opened 6 years ago

mukeshsinghr commented 6 years ago

I am trying to use add_siblings(*siblings) method to add more then one sibling at a time. I am giving array of users and I am getting above error. user.add_siblings([user1, user2,..])

Whereas If I pass objects comma separated its working fine. user.add_siblings(user1, user2,..) As per API document it should work.

For more details Please check the below stacktrace.

["/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/util_methods.rb:175:incheck_indiv'", "/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/util_methods.rb:162:in block in check_incompatible_relationship'", "/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/util_methods.rb:159:ineach'", "/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/util_methods.rb:159:in check_incompatible_relationship'", "/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/alter_methods.rb:184:inadd_siblings'", "/home/mukesh/.rvm/gems/ruby-2.5.1@go-server/gems/genealogy-2.5.1/lib/genealogy/alter_methods.rb:211:in `add_sibling'",

`

masciugo commented 6 years ago

you should use comma separated User objects.

So either: user.add_siblings(*[user1, user2,..]) or user.add_siblings(user1, user2,..)