diff --git a/lib/fluent/plugin/out_sql.rb b/lib/fluent/plugin/out_sql.rb index d55f9fe..23dfa79 100644 --- a/lib/fluent/plugin/out_sql.rb +++ b/lib/fluent/plugin/out_sql.rb @@ -206,7 +206,7 @@ def start end SQLOutput.const_set("BaseModel_#{rand(1 << 31)}", @base_model) - ActiveRecord::Base.establish_connection(config) + @base_model.establish_connection(config) # ignore tables if TableElement#init failed @tables.reject! do |te| @@ -224,7 +224,7 @@ def formatted_to_msgpack_binary end def write(chunk) - ActiveRecord::Base.connection_pool.with_connection do + @base_model.connection_pool.with_connection do @tables.each { |table| tag = format_tag(chunk.metadata.tag)