Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
has_many :through records duplication problem #27478
I think this problem is kind of this issue #16791.
There are my models:
I got the wrong value when querying my database due to the sql join:
It's a sql join issue not rails issue, and I try the DISTINCT to fix duplication records but still wrong
It works on query records, but not works on summarize. So when the same statement to sum money, I got this SQL:
It selects the distinct field of SUM("transactions"."money"), so doesn't work on the duplication.
In last, I make a solution to use subquery.
But it's not a good solution if we need more straight thinking . Anyone have idea about how to face the has_many :through with duplication?
This issue has been automatically marked as stale because it has not been commented on for at least three months.