Skip to content

Commit

Permalink
Use the ConnectionManagement AR middelware
Browse files Browse the repository at this point in the history
Concerns bmizerany#10
  • Loading branch information
janko committed Aug 25, 2015
1 parent 03c763a commit 33b2955
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/sinatra/activerecord.rb
Expand Up @@ -24,9 +24,9 @@ def self.registered(app)

app.helpers ActiveRecordHelper

# re-connect if database connection dropped
# re-connect if database connection dropped (Rails 3 only)
app.before { ActiveRecord::Base.verify_active_connections! if ActiveRecord::Base.respond_to?(:verify_active_connections!) }
app.after { ActiveRecord::Base.clear_active_connections! }
app.use ActiveRecord::ConnectionAdapters::ConnectionManagement
end

def database_file=(path)
Expand Down

0 comments on commit 33b2955

Please sign in to comment.