Production.log give No method error and Discourse not working

Yes, you are wrong. Safe mode affects only the front-end app (JS + CSS) and has nothing to do with Ruby.

As I said in my previous reply