ActiveRecord::Base.verify_active_connections!
은 2012 년 레일 커밋 9d1f1b1ea9e5d637984fda4f276db77ffd1dbdcb에서 제거되었습니다. 그래서 우리는 그 방법을 사용할 수 없습니다.
아래의 문장은 짧은 조사 결과입니다. 나는 레일 activerecord의 전문가가 아니다. 그래서 신중하게 들어라.
comment in connection_pool.rb
그래서 어쩌면 당신 (그리고 I. 난 그냥 당신처럼 같은 상황이)가 풀에 연결을 반환해야
# 1. Simply use ActiveRecord::Base.connection as with Active Record 2.1 and
# earlier (pre-connection-pooling). Eventually, when you're done with
# the connection(s) and wish it to be returned to the pool, you call
# ActiveRecord::Base.clear_active_connections!. This will be the
# default behavior for Active Record when used in conjunction with
# Action Pack's request handling cycle.
을했다 (그러나이 정보가 도움이 바랍니다). 레일에 명시된 바와 같이 사용하는 경우
및 Action Pack's request handling cycle
로시나에서 풀에 연결을 반환, 우리는 항상 checkout_and_verify
, this line 같이 a different way
을 사용하는 9d1f1b1ea9e5d637984fda4f276db77ffd1dbdcb을 커밋 액티브 :: ConnectionAdapters :: ConnectionManagement
다음
use ActiveRecord::ConnectionAdapters::ConnectionManagement
및 사용 액션 팩 라이프 사이클을 준수함으로써 Basae.connection
.
def connection
# this is correctly done double-checked locking
# (ThreadSafe::Cache's lookups have volatile semantics)
@reserved_connections[current_connection_id] || synchronize do
@reserved_connections[current_connection_id] ||= checkout
end
end
동일한 증상이 있습니다. 그러나'ActiveRecord :: Base.verify_active_connections! '는 레일즈 커밋 9d1f1b1e와 함께 사라졌습니다. – ruseel