# useful for printing out SQL console
ActiveRecord::Base.logger = Logger.new(STDOUT)
Uploading from a file and multi type attachments and nice dropzone tutorial
# if you need to set the timezone for users.. just make sure the time_zone
# returns something sensible
class ApplicationController
around_filter :set_timezone_for_this_request, if: :current_user
def set_timezone_for_this_request(&block)
Time.use_zone(current_user.time_zone, &block)
end
end
# Set up a custom logger. View output in /log/my_error.log
class MyLogger < Logger
def format_message(severity, timestamp, progname, msg)
"[%s] %s\n" % [timestamp.to_s(:short), msg]
end
end
logfile = File.open(Rails.root.to_s + '/log/my_error.log','a')
logfile.sync = true
MYLOG = MyLogger.new(logfile)
# TO USE: MYLOG.info(<stuff>) (or whatever level of debug info you want to use)