Skip to content

Conversation

@cllns
Copy link

@cllns cllns commented Jul 2, 2024

I discovered this bug the other week. If you call join with a relation object, table_alias doesn't work at all. It only works with the name a symbol.

Note this is a PR against release-3.6, not main.

Each commit fixes a different situations, so I recommend viewing each commit separately.

assoc = associations[other]
assoc = associations.key?(other) && associations[other]

if join_cond.eql?(EMPTY_HASH) && !block
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if join_cond.eql?(EMPTY_HASH) && !block
if (join_cond.nil? || join_cond.empty?) && !block

I'd rather do this. It'd allow nil or {} or [] as join_cond, which are all valid IMO.

I'm not sure why this was .equal?, since that does object equality (so even passing in {} would be false since it's a different though identical object).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant