Giter Site home page Giter Site logo

genealogy's People

Contributors

cinziasala avatar eric-wowzers avatar estensland avatar masciugo avatar mjc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

genealogy's Issues

Expected User object. Got Array while adding siblings.

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:in each'", "/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:in add_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'",

`

Unable to add child in latest version 2.0.2

Hi,

I am the fan of genealogy. It saved a lot of my valuable time. I have used 1.5.0 till now. My Application was worked very well when i was in 1.5.0 version.

After updating to gem to latest version ( 2.0.2 ), i am not able to adding a child to user. It is throwing an exception called "User1 Can't be father of User2".

Please resolve the issue and let me know.

Thank you!

screenshot from 2015-03-19 12 36 40

undefined method `arity'

I'm getting: undefined method `arity' for {:class_name=>"Person", :optional=>true, :foreign_key=>"father_id"}:Hash

I'm using Ruby 3.0.0 and Rails 6.1.1. Followed all the install steps and added indexes, still crashing with said message. The entry point for the error is has_parents on person.rb.

Any ideas?

Sibling query half: :include fails in 2.0.2

The query for siblings @member.siblings(half: :include) fails due to an invalid query:

ERROR: operator does not exist: integer == integer

Seems that Postgres (and probably other SQL languages) do not support the double equals operator. Found at line 104 of query_methods.rb.

Rails 5.2 class instead of class_name depreciation warning

Hi, thanks for the great gem.
Having upgraded to rails 5.1, I'm getting the following depreciation warning:
Passing a class to the class_name is deprecated and will raise an ArgumentError in Rails 5.2. It eagerloads more classes than necessary and potentially creates circular dependencies. Please pass the class name as a string: `belongs_to :father
Should be an easy fix by passing self.class_name instead of self in the belongs_to and has_many relationships?
Thanks!

Spouse without children

Hi,

Great gem, no problems so far with it, but seem to have now hit a limitation which is setting up a spouse, or multiple without children. Had a look at the master code and doesnt look like this is supported, do you have any thoughts on this?

I was thinking about a join table, which could keep some additional metadata with it, like status of relationship, eg divorced, and others like wedding date, or anything else that makes sense.

In my app, i'll either just implement a hidden child, or a join table, but if you've got any idea of direction yourself, i could help out.

thanks,
Stewart.

How to support Unknown Gender as sex value.

Hi @masciugo,

I have the fixed the previous my issues my own. They are working :)

I wanted to support the use case where I can have gender as Unknown - U as value.

Is it possible ? I am trying to do so but getting many things to change. Still facing issues. This is kind of very important for me to solve at this stage.
Can you please help and let me know the possibility.

Thanks,
Mukesh

can't be sibling of

How to check if the User is already in the list of sibling ?

It fails during siblings assignment when there is already User in DB as sibling. Either this case to be handled or we can give a method to check user if he has added sibling already.

Please let me know if you want more details.

mongoid

Great gem, it works with active record.
Is there a way I can use mongoid? thx

spouses method is not considering the current spouse

Currently spouses method is just checking if there is any children with the spouse or not. In case no children then its omitting the spouse.

Say for eg.
User has added current spouse but has no children yet. When he checks spouses method it returns no result. If user checks using current_spouse method then it shows a result.

I believe we should consider current_spouse as well for spouses.

Ref: https://github.com/masciugo/genealogy/blob/master/lib/genealogy/query_methods.rb#L63

Please clarify how to best add indexes

Hi there!

Thanks for this gem. I'm a bit confused how to best add indexes to my project though. Specifically how to do the "in combination" part. You say:

Add indexes, separately and in combination, to parents columns

And I have this so far:

class AddIndexToPeople < ActiveRecord::Migration
  def change
    add_index :people, :father_id
    add_index :people, :mother_id
    add_index :people, :current_spouse_id
    add_index :people, [:father_id, :mother_id]
  end
end

I'm not sure about that last one though. Can you help fill in the missing blanks for me? Thanks!

query methods for parents

I'm trying to do something like the code shown below but rails returns undefined method name for nil
% if @person.parents %>
<% if @person.mother %>


Mother:
<%= @person.mother.name %>


<% end %>

<% if @person.father %>
   	<p>
	  <strong>Father:</strong>
	  <%= @person.father.name %>
	</p>
<% end %>  

<% end %>

Current_spouse option

Hey, thank you for this gem, really helpful for my project.
There is a small mistake in the error message raised by the current_spouse option defined in the private method raise_unless_current_spouse_enabled. The message should be

Spouse tracking not enabled. Enable it with option 'current_spouse: true' for has_parents method}

instead of

Spouse tracking not enabled. Enable it with option 'current_spouse_enabled: true' for has_parents method}

Cheers

undefined method `its' for Class when running the specs

Hello,

I get this error when running bundle exec rake :

genealogy[master]: bundle exec rake
/Users/aurels/.rbenv/versions/1.9.3-p448/bin/ruby -I/Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib:/Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-support-3.0.3/lib -S /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec ./spec/genealogy/alter_current_spouse_spec.rb ./spec/genealogy/alter_grandparents_spec.rb ./spec/genealogy/alter_offspring_spec.rb ./spec/genealogy/alter_parents_spec.rb ./spec/genealogy/alter_siblings_spec.rb ./spec/genealogy/model_lifecycle_spec.rb ./spec/genealogy/model_settings_spec.rb ./spec/genealogy/query_methods_spec.rb --format documentation --color
/Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:23:in `block (4 levels) in <module:AlterCurrentSpouseSpec>': undefined method `its' for #<Class:0x007fc954f27428> (NoMethodError)
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `module_exec'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `subclass'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:227:in `block in define_example_group_method'
  from /Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:21:in `block (3 levels) in <module:AlterCurrentSpouseSpec>'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `module_exec'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `subclass'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:227:in `block in define_example_group_method'
  from /Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:19:in `block (2 levels) in <module:AlterCurrentSpouseSpec>'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `module_exec'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `subclass'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:227:in `block in define_example_group_method'
  from /Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:16:in `block in <module:AlterCurrentSpouseSpec>'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `module_exec'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:331:in `subclass'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/example_group.rb:227:in `block in define_example_group_method'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/dsl.rb:41:in `block in expose_example_group_alias'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/dsl.rb:79:in `block (2 levels) in expose_example_group_alias_globally'
  from /Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:6:in `<module:AlterCurrentSpouseSpec>'
  from /Users/aurels/Dev/genealogy/spec/genealogy/alter_current_spouse_spec.rb:3:in `<top (required)>'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `block in load_spec_files'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `each'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/configuration.rb:1057:in `load_spec_files'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:97:in `setup'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:85:in `run'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:70:in `run'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib/rspec/core/runner.rb:38:in `invoke'
  from /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec:4:in `<main>'
/Users/aurels/.rbenv/versions/1.9.3-p448/bin/ruby -I/Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/lib:/Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-support-3.0.3/lib -S /Users/aurels/.rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/rspec-core-3.0.3/exe/rspec ./spec/genealogy/alter_current_spouse_spec.rb ./spec/genealogy/alter_grandparents_spec.rb ./spec/genealogy/alter_offspring_spec.rb ./spec/genealogy/alter_parents_spec.rb ./spec/genealogy/alter_siblings_spec.rb ./spec/genealogy/model_lifecycle_spec.rb ./spec/genealogy/model_settings_spec.rb ./spec/genealogy/query_methods_spec.rb --format documentation --color failed

Any idea why ?

Best,

Aurels

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.