]> 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 049f6e02ea79207556505e5e104105ecc3809104..0988fcdf8bf64aab93ce4759fe767c3b518c691a 100644 (file)
@@ -5,6 +5,7 @@ class ApplicationController < ActionController::Base
 
   before_action :fetch_body
 
+  attr_accessor :current_user
   helper_method :current_user
 
   def authorize_web
@@ -49,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
 
   ##
@@ -345,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
 
   ##
@@ -468,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