Please sign in to comment.
Fix issue with collection associations and first(n)/last(n)
When calling first(n) or last(n) in a collection, Active Record was improperly trying to set the inverse of instance in case that option existed. This change was introduced by fdf4eae. In such cases we don't need to do that "manually", since the way collection will be loaded will already handle that, so we just skip setting the inverse association when any argument is given to first(n)/last(n). The test included ensures that these scenarios will have the inverse of instance set properly. Fixes #8087, Closes #8094. Squashed cherry-pick from d37d40b and c368b66. Conflicts: activerecord/CHANGELOG.md activerecord/lib/active_record/associations/collection_association.rb
- Loading branch information...
Showing with 16 additions and 1 deletion.