Method: ActiveRecord::ConnectionHandling#connection
- Defined in:
- activerecord/lib/active_record/connection_handling.rb
#connection ⇒ Object
Soft deprecated. Use #with_connection or #lease_connection instead.
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'activerecord/lib/active_record/connection_handling.rb', line 274 def connection pool = connection_pool if pool.permanent_lease? case ActiveRecord.permanent_connection_checkout when :deprecated ActiveRecord.deprecator.warn <<~MESSAGE Called deprecated `ActiveRecord::Base.connection` method. Either use `with_connection` or `lease_connection`. MESSAGE when :disallowed raise ActiveRecordError, <<~MESSAGE Called deprecated `ActiveRecord::Base.connection` method. Either use `with_connection` or `lease_connection`. MESSAGE end pool.lease_connection else pool.active_connection end end |