]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Use send_data for GPX traces intead of monkey patching send_file
[rails.git] / app / controllers / application_controller.rb
index a809139cec656e2f0142790b3e7b3a1c862c5404..0988fcdf8bf64aab93ce4759fe767c3b518c691a 100644 (file)
@@ -5,6 +5,9 @@ class ApplicationController < ActionController::Base
 
   before_action :fetch_body
 
+  attr_accessor :current_user
+  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 +50,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
 
   ##
@@ -343,7 +346,7 @@ class ApplicationController < ActionController::Base
   # or raises a suitable error. +method+ should be a symbol, e.g: :put or :get.
   def assert_method(method)
     ok = request.send((method.to_s.downcase + "?").to_sym)
-    raise OSM::APIBadMethodError.new(method) unless ok
+    raise OSM::APIBadMethodError, method unless ok
   end
 
   ##
@@ -466,16 +469,6 @@ class ApplicationController < ActionController::Base
     [user, pass]
   end
 
-  # used to get the current logged in user
-  def current_user
-    @user
-  end
-
-  # used to set the current logged in user
-  def current_user=(user)
-    @user = user
-  end
-
   # override to stop oauth plugin sending errors
   def invalid_oauth_response; end
 end