Comparison of NilClass with Time failed


(Shiv Kumar) #1

Getting the error page below when trying to start up Discourse in local development mode. Is this user error or a Discourse bug? Either way, any ideas how to fix? Thanks!


(Shiv Kumar) #2

Upon further investigation, it seems that this line is returning nil:

Dir.glob("#{Rails.root}/plugins/**/assets/stylesheets/**/*.*css").max

Seems to work if we change that line to the following (eliminate 1 asterisk):

Dir.glob("#{Rails.root}/plugins/*/assets/stylesheets/**/*.*css").max

(Sam Saffron) #3

Is this fixed now cc @neil


(Shiv Kumar) #4

When we removed that asterisk and deployed to our staging environment, everything worked fine, but for some reason when we deployed to production, we got a ton of these errors in New Relic:

ActionView::Template::Error: Permission denied - /var/www/discourse/public/uploads/stylesheet-cache/desktop_10fc499d2df47f470ce26d626f66062dced9a906.css

We’ve since reverted to a previous version of Discourse. So I’m not sure this actually fixed anything…


(Neil Lalonde) #5

@shiv The permissions on the public/uploads and public/backups directory were wrong. I corrected them.


(Neil Lalonde) #6

About the original issue, the fix was to remove nils from the array before looking for the max value. nil is returned when no matches are found by glob.


(Jeff Atwood) #7