Skip to content

Commit b900166

Browse files
committed
Work around Rails error that won't read a model fetched from cache in dev mode properly
1 parent 370a227 commit b900166

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

app/models/protip.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,10 @@ def already_created_a_protip_for(url)
316316
end
317317

318318
def valid_reviewers
319+
User # Hack to force loading User model before it gets read from cache and explodes in dev.
319320
Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) do
320321
if ENV['REVIEWERS']
321-
User.where(username: YAML.load(ENV['REVIEWERS'])).all
322+
User.where(username: YAML.load(ENV['REVIEWERS'])).to_a
322323
else
323324
[]
324325
end

0 commit comments

Comments
 (0)