clean up duplicate code

This commit is contained in:
Connor Turland 2016-03-11 17:26:54 +11:00
parent 059591b78b
commit ccfba03fdb
6 changed files with 9 additions and 41 deletions

View file

@ -1,11 +1,3 @@
class Api::MappingsController < API::RestfulController
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
end

View file

@ -1,11 +1,3 @@
class Api::MapsController < API::RestfulController
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
end

View file

@ -1,6 +1,14 @@
class API::RestfulController < ActionController::Base
snorlax_used_rest!
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
def show
load_resource
raise AccessDenied.new unless resource.authorize_to_show(current_user)

View file

@ -1,11 +1,3 @@
class Api::SynapsesController < API::RestfulController
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
end

View file

@ -1,13 +1,5 @@
class Api::TokensController < API::RestfulController
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
def my_tokens
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_collection page_collection: false, timeframe_collection: false

View file

@ -1,11 +1,3 @@
class Api::TopicsController < API::RestfulController
def create
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
instantiate_resouce
resource.user = current_user
create_action
respond_with_resource
end
end