clean up duplicate code
This commit is contained in:
parent
059591b78b
commit
ccfba03fdb
6 changed files with 9 additions and 41 deletions
|
@ -1,11 +1,3 @@
|
||||||
class Api::MappingsController < API::RestfulController
|
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
|
end
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
class Api::MapsController < API::RestfulController
|
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
|
end
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
class API::RestfulController < ActionController::Base
|
class API::RestfulController < ActionController::Base
|
||||||
snorlax_used_rest!
|
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
|
def show
|
||||||
load_resource
|
load_resource
|
||||||
raise AccessDenied.new unless resource.authorize_to_show(current_user)
|
raise AccessDenied.new unless resource.authorize_to_show(current_user)
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
class Api::SynapsesController < API::RestfulController
|
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
|
end
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
class Api::TokensController < API::RestfulController
|
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
|
def my_tokens
|
||||||
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
|
raise CanCan::AccessDenied.new unless current_user.is_logged_in?
|
||||||
instantiate_collection page_collection: false, timeframe_collection: false
|
instantiate_collection page_collection: false, timeframe_collection: false
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
class Api::TopicsController < API::RestfulController
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue