This project is archived and is in readonly mode.
belongs_to with :primary_key does not work with find's :include
-
CancelProfileIsBroken
- Tag changed from 2.3.3, :include, associations, belongs_to to 2.3.3, :include, associations, belongs_to, bugmash
-
Matt Mitchell
I'm uploading a patch here. The JoinAssociation.associtation_join method now first checks for the reflection.options[:primary_key] and then defaults to reflection.klass.primary_key if the option is missing. This is my first patch so please let me know if this isn't the way to do it.
-
Deleted User
- Tag changed from 2.3.3, :include, associations, belongs_to, bugmash to 2, :include, associations, belongs_to, bugmash
I'm using Rails 2.3.4, and I'm seeing this behaviour too.
-
Yaroslav Markin
- Assigned user set to Frederick Cheung
Rails 2.3.5, before the patch I was having horrible problems with ThinkingSphinx indexing belongs_to association with :primary_key. Applied it, works just fine.
-
Alexey Nayden
The bug confirmed at 2.3.5. However patch works fine.
-
Rizwan Reza
- Tag changed from 2, :include, associations, belongs_to, bugmash to 2, :include, associations, belongs_to
-
humanzz
I just stumbled upon this bug in Rails 2.3.5 too :(
-
Yaroslav Markin
- Tag changed from 2, :include, associations, belongs_to to 2, :include, activerecord, associations, belongs_to, bug, patch
- Assigned user changed from Frederick Cheung to José Valim
Requesting committer attention :)
-
José Valim
- Assigned user changed from José Valim to Jeremy Kemper
-
Jeremy Kemper
Still pending tests.
-
José Valim
- Tag changed from 2, :include, activerecord, associations, belongs_to, bug, patch to 2, :include, activerecord, associations, belongs_to, bug, bugmash, patch
-
Łukasz Strzałkowski
Jeremy, isn't that fixed and tested with this commit?
http://github.com/rails/rails/commit/00b95eb265ff606ae0a7b650265aa3...
Personally I think the test is week.
-
Jeremy Kemper
Definitely needs a better test.
-
Ernie Miller
I'll cook something better up.
-
Łukasz Strzałkowski
Quick one
-
Ernie Miller
Updated tests for 2-3-stable and master
-
Ernie Miller
- Tag changed from 2, :include, activerecord, associations, belongs_to, bug, bugmash, patch to 2, :include, activerecord, associations, belongs_to, bug, bugmash, patch, tests
-
HBpencil
try this
class Region set_primary_key :zip end -
Anil Wadghule
+1
Verified both patches of tests on rails 3 master and 2-3 stable. HBpencil what are you trying to say? If possible more tests would be good.
-
Rizwan Reza
- Tag changed from 2, :include, activerecord, associations, belongs_to, bug, bugmash, patch, tests to 2, :include, activerecord, associations, belongs_to, bug, bugmash-review, patch, tests
- State changed from incomplete to verified
-
Łukasz Strzałkowski
- Importance changed from to Medium
This ticket actually can be closed. It's duplicate of #765 PATCH: primary_key option for belongs_to
and this is solved by this commit: http://github.com/rails/rails/commit/63026541b209cc11ffd74cf3ca04b8...
-
Andrea Campi
- Tag changed from 2, :include, activerecord, associations, belongs_to, bug, bugmash-review, patch, tests to 2-3-stable, :include, activerecord, associations, belongs_to, bug, bugmash-review, patch, tests
