This project is archived and is in readonly mode.
Using Model.includes(:relation_with_custom_primary_key)
-
Erik Fonselius
sorry missed the env
ubuntu 10.04 64bit
1.9.2 p0 in rvm
Rails 3.0.0 -
Denis Odorcic
- Tag set to patch
Attached a failing test and fix. It was only comparing strings, so if you pass in a symbol to :primary_key it'll fail.
-
Aditya Sanghi
- State changed from new to open
- Milestone set to 3.0.2
- Assigned user set to Aaron Patterson
- Tag changed from patch to active_record, patch
Test applies fine on master.
Not so sure about the multi-line primary_key assignment.
primary_key = (clause1 || clause2).to_sinstead of
primary_key = clause1 || clause2 primary_key = primary_key.to_sJust my 2 cents.
-
Aditya Sanghi
- Milestone changed from 3.0.2 to 3.x
We should perhaps document this as well, as i think documentation only has examples of primary_key being specified as a string not as a symbol.
Pushing this to 3.x instead of 3.0.2 as it is not technically a bug, it's almost a feature request to get symbols as primary_key supported.
-
Denis Odorcic
I can update the patch tonight if the one-liner is the preferred method.
-
Denis Odorcic
Added one-liner so whatever the committer prefers
-
Aditya Sanghi
- State changed from open to verified
-
Repository
- State changed from verified to resolved
(from [cc9742920ccaf8e985fbe5239edb966949eb91c3]) Convert :primary_key in association to a string before comparing to column names, so that for example :primary_key => :another_pk works as well [#5605 Using Model.includes(:relation_with_custom_primary_key) state:resolved] http://github.com/rails/rails/commit/cc9742920ccaf8e985fbe5239edb96...
