This project is archived and is in readonly mode.
has_one :through a belongs_to association will return nil on deleted records
-
John Hawthorn
Here is my attempt at a patch
It adds foreign_key_present to HasOneThroughAssociation which returns true when the through_reflection is a belongs_to and primary_key is not nil. Also adds test cases.
-
John Hawthorn
It seems that the commit which caused this issue (https://github.com/rails/rails/commit/f1c13b0dd7b22b5f6289ca1a09f1d...) has been reverted (https://github.com/rails/rails/commit/e444439fe28f873c783a4b99b1c9f....
I've attached a new patch which contains only the test case.
-
Aaron Patterson
- State changed from new to open
- Milestone cleared.
- Assigned user set to Aaron Patterson
- Importance changed from to Low
-
Repository
- State changed from open to resolved
(from [28896a9f4ae0830726619bc479f69263acb80e4b]) test case on has_one :through after a destroy
[#6037 has_one :through a belongs_to association will return nil on deleted records state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
https://github.com/rails/rails/commit/28896a9f4ae0830726619bc479f69... -
Repository
(from [52e854e90025edfcf2c4665b81b17d3cd840f9d9]) test case on has_one :through after a destroy
[#6037 has_one :through a belongs_to association will return nil on deleted records state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
https://github.com/rails/rails/commit/52e854e90025edfcf2c4665b81b17...
