From 6b176bfcefd1d6d195a354a445505a344f2106ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Str=C3=B6m?= Date: Thu, 1 Jul 2010 11:35:51 +0200 Subject: [PATCH] load the middleware the rails 3 way using a railtie --- lib/authlogic_oauth2.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/authlogic_oauth2.rb b/lib/authlogic_oauth2.rb index d495851..306456e 100644 --- a/lib/authlogic_oauth2.rb +++ b/lib/authlogic_oauth2.rb @@ -11,7 +11,13 @@ # Throw callback rack app into the middleware stack if defined?(ActionController::Metal) - Rails.configuration.middleware.use(Oauth2CallbackFilter) # Rails >= 3.0 + module AuthlogicOAuth2 + class Railtie < Rails::Railtie + initializer :load_oauth2_callback_filter do |app| + app.config.middleware.use(Oauth2CallbackFilter) # Rails >= 3.0 + end + end + end else ActionController::Dispatcher.middleware.use(Oauth2CallbackFilter) # Rails < 3.0 end \ No newline at end of file