Hi,

Following are the 3 classes in which one class is of class table inheritance

class User < Sequel::Model
  #table_name :users
  plugin :class_table_inheritance, key: :type
end

class Employee < User
  #table_name :employees
  many_to_one :department
end

class Department < Sequel::Model
  one_to_many :employees
end


@department.remove_employee(@employee) fails as it throws *an exception 
stating that :id is ambiguous*

The exact line which causes this problem is the call to :*pk_hash* instead 
of :*qualified_pk_hash*

https://github.com/jeremyevans/sequel/blob/588c5c65350b7f5aa82b6eb9e7115eaa6f51d8fb/lib/sequel/model/associations.rb#L2535

The same can be replicated as below:

Employee.dataset.where(@employee.pk_hash) throws the exception for :id 
being ambiguous

Is there any reason why pk_hash is used in Dataset#where query instead of 
:qualified_pk_hash? I've overridden (patch work) the pk_hash method to 
return the qualified_pk_hash to make it work.


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to