On Wednesday, November 16, 2016 at 5:45:43 PM UTC-8, binarypaladin wrote:
>
> Example:
>
> TableOne
>   many_to_one :table_two, key: [:col_1, :col_2, :col_3], primary_key: 
> [:col_1, :col_2, :col_3]
> end
>
> TableTwo
>   one_to_many :table_ones, key: [:col_1, :col_2, :col_3], primary_key: 
> [:col_1, :col_2, :col_3]
> end
>
> Now, presuming these line up:
>
> t1 = TableOne.first
> t1.table_two => nil
> t1.table_two_dataset.first => <instance of TableTwo>
>
> This behavior only seems to happen when one of the columns is null. And 
> the behavior is true if I attempt the association in the other direction.
>
> Is this behavior intended or am I missing something? The only way I could 
> replicate it was a null key. (In my real life problem, the key in both 
> tables had a foreign key constraint on a third table that is optionally 
> null.)
>

Thanks for the report.  This is not intended, it probably happens because 
:column=>nil is translated to column IS NULL instead of column = NULL.  We 
should fix it by making table_two_dataset use where(false) if any of the 
key columns is nil.  I'll work on that tomorrow.

Thanks,
Jeremy

-- 
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