Created
April 20, 2017 20:08
-
-
Save kenaniah/f54056c5b2e841820e36d038580eba36 to your computer and use it in GitHub Desktop.
Sequel CTI Association Filtering Issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Related < Sequel::Model; end | |
class Parent < Sequel::Model | |
plugin( | |
:class_table_inheritance, | |
key: :type, | |
table_map: { | |
:Child => :children | |
} | |
) | |
many_to_one :related | |
end | |
class Child < Parent; end | |
# Works | |
Child.first.related | |
# Works | |
Child.where(related_id: Related[1].id) | |
# Breaks with: WHERE ("children"."related_id" = 1) | |
Child.where(related: Related[1]) # Should have referenced "parents"."related_id" instead |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment