Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix referencing wrong aliases while joining tables of has many through association #19452

Conversation

pinglamb
Copy link
Contributor

Fix for Issue #19276.

While joining table of has_many :through association, ActiveRecord will use the actual table name instead of through-join alias. It results with a wrong SQL and exception is raised. This only happens when calculation methods like #count is called.

This bug is affecting Rails 4.1.x and 4.2.x as well.

association

While joining table of has_many :through association, ActiveRecord will
use the actual table name instead of through-join alias. It results with
a wrong SQL and exception is raised. This only happens when calculation
methods like #count is called.

This issue is affecting Rails 4.1.x and 4.2.x as well.
carlosantoniodasilva added a commit to carlosantoniodasilva/rails that referenced this pull request Mar 24, 2015
…ias-when-joining-tables-of-has-many-through-association

Fix referencing wrong aliases while joining tables of has many through association
@carlosantoniodasilva carlosantoniodasilva merged commit ba057a5 into rails:master Mar 24, 2015
carlosantoniodasilva added a commit that referenced this pull request Mar 24, 2015
…hen-joining-tables-of-has-many-through-association

Fix referencing wrong aliases while joining tables of has many through association
carlosantoniodasilva added a commit that referenced this pull request Mar 24, 2015
…hen-joining-tables-of-has-many-through-association

Fix referencing wrong aliases while joining tables of has many through association
@carlosantoniodasilva
Copy link
Member

Backports:

Thanks.

kamipo added a commit to kamipo/rails that referenced this pull request Jun 12, 2016
`construct_relation_for_association_calculations` pass a string value to
`construct_join_dependency` when setting a string value in `from`.
It should not pass a string value, but always `joins_values`.

Related rails#14834, rails#19452.

Fixes rails#24193.
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.

None yet

2 participants