fix tokens

This commit is contained in:
Connor Turland 2016-03-12 12:26:23 +11:00
parent 521aa6b5d0
commit bf4fbbeb06
2 changed files with 7 additions and 3 deletions

View file

@ -5,7 +5,7 @@ class API::RestfulController < ActionController::Base
snorlax_used_rest!
rescue_from(Pundit::NotAuthorizedError) { |e| respond_with_standard_error e, 403 }
load_and_authorize_resource except: [:index, :create]
load_and_authorize_resource only: [:show, :update, :destroy]
def create
authorize resource_class

View file

@ -1,13 +1,17 @@
class Api::TokensController < API::RestfulController
skip_authorization
def my_tokens
raise Pundit::NotAuthorizedError.new unless current_user
instantiate_collection page_collection: false, timeframe_collection: false
respond_with_collection
end
private
def resource_serializer
"#{resource_name}_serializer".camelize.constantize
end
def visible_records
current_user.tokens
end