]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Convert @user to current_user
[rails.git] / app / controllers / application_controller.rb
index a809139cec656e2f0142790b3e7b3a1c862c5404..a367a1b0a756ed257ea68905d98af50e6b4fe6a6 100644 (file)
@@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
 
   before_action :fetch_body
 
+  helper_method :current_user
+
   def authorize_web
     if session[:user]
       self.current_user = User.where(:id => session[:user]).where("status IN ('active', 'confirmed', 'suspended')").first
@@ -47,7 +49,7 @@ class ApplicationController < ActionController::Base
   end
 
   def require_oauth
-    @oauth = @user.access_token(OAUTH_KEY) if current_user && defined? OAUTH_KEY
+    @oauth = current_user.access_token(OAUTH_KEY) if current_user && defined? OAUTH_KEY
   end
 
   ##