-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Description
I have a relationship that includes selected columns (I'm honestly doubting whether this is a good idea at all now that I've ran into this), and it worked through 4.0.x. Updating the app to 4.1.0rc1 showed this behavior no longer works and results in an SQL error, as the select
is not dropped from the query constructed.
Essentially, creating a relationship in this fashion (my actual use case is more sane, at least in theory, separating two very distinct classifications of relationships but also wanting to get the join table properties as well):
has_many :prime_categories,
-> {
includes(:post_category)
.references(:post_category)
.where(post_categories: { prime: true })
.select("post_categories.id, categories.*")
},
through: :post_categories,
source: :category
In the gist I also have commented out the explicit includes
and references
, as they don't make a difference in 4.1.
Failing executable gist:
https://gist.github.com/jshirley/9744173
Note: This example does pass with activerecord 4.0.0 activated (the select
is not included in the query).