This project is archived and is in readonly mode.
Bug in nested_attributes when the primary key is not "id"
-
Pratik
Hey Mathieu,
We can't use find() as it'll raise an exception on the missing record. I think the fix it to make sure {:id => ..} condition hash uses the appropriate primary key.
Do you wanna submit a patch for it ? http://guides.rubyonrails.org/contributing_to_rails.html might help if you haven't done it before !
Thanks.
-
Pratik
Hey Mathieu,
We can't use find() as it'll raise an exception on the missing record. I think the fix it to make sure {:id => ..} condition hash uses the appropriate primary key.
Do you wanna submit a patch for it ? http://guides.rubyonrails.org/contributing_to_rails.html might help if you haven't done it before !
Thanks.
-
Mathieu Arnold
I had not thought of missing records, in that case, you just need to do a :
association.all(:conditions => {association.primary_key => attribute_ids})As for a patch, well, this fixes it, but for a proper patch with tests, I'll have to think about it :-)
-
Mathieu Arnold
Here is a patch, with a test.
-
Pratik
The patch looks good. Do you want to upload another patch using git format-patch so that you are attributed properly for your contribution ?
Thanks.
-
Mathieu Arnold
Here it is.
-
Mathieu Arnold
Any news on this ?
-
Repository
- State changed from new to resolved
(from [f194d65f36be29971601664c880cb9b23ee2a95b]) Use primary key in conditions, not 'id' [#4395 Bug in nested_attributes when the primary key is not "id" state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
Conflicts:
activerecord/test/cases/nested_attributes_test.rbhttp://github.com/rails/rails/commit/f194d65f36be29971601664c880cb9...
-
Repository
(from [38da0ace772e6f9f5e2fff74db76237ab31790fa]) Use primary key in conditions, not 'id' [#4395 Bug in nested_attributes when the primary key is not "id" state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com
http://github.com/rails/rails/commit/38da0ace772e6f9f5e2fff74db7623...
