Skip to content

Conversation

@pdgonzalez872
Copy link

Hi @benwilson512!

Thanks for all of your work in the community! ❤️

I think there is a small bug in has_many through associations. They end up losing order_bys. many_to_many works as expected. I was going to create an issue for this, but found this one #169.

Seems like this commit may have caused it -> 37cd17f, but there seems to be some work around that time, maybe it was something else that did it.

In this PR:

  • the first commit shows how ordering IS preserved in many_to_many cases.
  • the second adds a failing test that shows how has_many through is no longer sorted
  • the third adds a test to prove that has_many (not through) sorts as expected
  • the fourth, tries to solve the issue.

Please let me know if this makes sense to you. Dataloader is new to me, I'm trying to wrap my head around it.

The fix works as expected, there is already code that handles distinct correctly (I ran into some errors with this in application code), so this could potentially be a way of fixing this.

Note: This could totally be a me thing, not understanding how to use Dataloader correctly, but once I was able to create the failing tests it started to convince me.

Thank you

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