Skip to content

Instantly share code, notes, and snippets.

@kenaniah
Created April 20, 2017 20:08
Show Gist options
  • Save kenaniah/f54056c5b2e841820e36d038580eba36 to your computer and use it in GitHub Desktop.
Save kenaniah/f54056c5b2e841820e36d038580eba36 to your computer and use it in GitHub Desktop.
Sequel CTI Association Filtering Issue
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