Rails ActiveRecord How to Disable Logging of Specific Requests

I am in developer mode in Rails.
I am trying to insert a binary data record into a DB using AR.

Edoc.create(
            :id_claim => @claim_index, 
            :id_material => @doc_code, 
            :size => @file_list.first[:size],
            :efile => params[:files][0].read
        )   

But this takes a lot of time because Rails logs this request with all the contents of the file.

How to disable logging of specific queries?

+1
source share
1 answer

Try:

old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
# your code here...

Restore the registrar:

ActiveRecord::Base.logger = old_logger; nil # nil just to suppress some garbage 
0
source

All Articles