summaryrefslogtreecommitdiff
path: root/app/controllers/v1
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2014-07-14 15:49:31 +0200
committerAzul <azul@leap.se>2014-07-14 15:58:30 +0200
commit67f70b31bd16b05759e1f8393f077ee17f2c34be (patch)
treec269a2a342fdc6974cbf55586eb12832bb45e25e /app/controllers/v1
parentf07c952c870bfb8634ef0d80737b67a1eec760f6 (diff)
move fetch_user into module so it can be mixed in
We have an ApiController that wants to call #fetch_user. Since we can only inherit from one class i moved fetch_user into an extension.
Diffstat (limited to 'app/controllers/v1')
-rw-r--r--app/controllers/v1/users_controller.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/controllers/v1/users_controller.rb b/app/controllers/v1/users_controller.rb
index 5c9e33f..bfa04fc 100644
--- a/app/controllers/v1/users_controller.rb
+++ b/app/controllers/v1/users_controller.rb
@@ -1,5 +1,6 @@
module V1
class UsersController < ApiController
+ include ControllerExtension::FetchUser
before_filter :fetch_user, :only => [:update]
before_filter :require_admin, :only => [:index]
@@ -35,13 +36,5 @@ module V1
head :forbidden
end
end
-
- def fetch_user
- @user = User.find(params[:id])
- if @user != current_user
- access_denied
- end
- end
-
end
end