Class: Subserver::Middleware::ActiveRecord
- Inherits:
-
Object
- Object
- Subserver::Middleware::ActiveRecord
- Defined in:
- lib/subserver/middleware/active_record.rb
Instance Method Summary collapse
- #call(*args) ⇒ Object
-
#initialize ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
Constructor Details
#initialize ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
6 7 8 9 10 11 12 |
# File 'lib/subserver/middleware/active_record.rb', line 6 def initialize # With Rails 5+ we must use the Reloader **always**. # The reloader handles code loading and db connection management. if defined?(::Rails) && ::Rails::VERSION::MAJOR >= 5 raise ArgumentError, "Rails 5 no longer needs or uses the ActiveRecord middleware." end end |
Instance Method Details
#call(*args) ⇒ Object
14 15 16 17 18 |
# File 'lib/subserver/middleware/active_record.rb', line 14 def call(*args) yield ensure ::ActiveRecord::ConnectionAdapters::ConnectionHandler.clear_active_connections! end |