This project is archived and is in readonly mode.
has_many :through assoc_ids incorrect with :primary_key option on belongs_to source
Reported by Jon Leighton | February 5th, 2011 @ 08:39 AM | in 3.x
Initially reported in the comments at https://rails.lighthouseapp.com/projects/8994/tickets/2421-problem-...
Okay, a bit more information. I have:
class Phenotype
has_many :observations
has_many :genes, :through => :observations
end
class Observation
belongs_to :gene, :primary_key => :entrez_id
end
It used to be that when I did Phenotype.find(48291).gene_ids, it would give me the entrez_id attribute rather than the primary keys. This makes sense. I don't use id for anything at all, which is why I set entrez_id as the primary. Unfortunately, in the current beta, gene_ids returns the :id attribute on each gene.
There are obvious workarounds, but this is obnoxious, and it can't be the correct behavior.
Comments and changes to this ticket
-
Repository February 18th, 2011 @ 05:15 PM
- State changed from open to resolved
(from [f0b98050296b57d95dbc789f8e52fa82499d151a]) Ensure that association_ids uses the correct attribute where the association is a has_many :through with a :primary_key option on the source reflection. [#6376 state:resolved] https://github.com/rails/rails/commit/f0b98050296b57d95dbc789f8e52f...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Referenced by
- 6376 has_many :through assoc_ids incorrect with :primary_key option on belongs_to source (from [f0b98050296b57d95dbc789f8e52fa82499d151a]) Ensure ...