Commit 4858dbd1 authored by Dylan Griffith's avatar Dylan Griffith

Fix NullPreloader#run -> self used for preload attemps on Commit

Without this we receive an exception
`undefined method `preloaded_records' for nil:NilClass`
when trying to call
`Note.includes(noteable: {assignees: []})`
if any of the notes are on a `Commit`. The reason this seems to happen
is due to a refactoring in Rails preloaders in
https://github.com/rails/rails/commit/2847653869ffc1ff5139c46e520c72e26618c199#diff-6d659f140c909c5a70850ec69eab0014834ffb371029ccf7554b6a421a1fb0ca
which expects the `#run` method to return the preloader (you can see
other examples updated to return `self`).

It is possible longer term that this may be made redundant
by some much larger refactoring happening to this code in
https://github.com/rails/rails/pull/41385 since it appears this no
longer relies on the return value of `#run`. But that is not released
yet and we may end up with more problems to solve when we upgrade to
that.
parent babc2fe7
......@@ -9,6 +9,7 @@ module ActiveRecord
end
def self.run
self
end
def self.preloaded_records
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment