2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2016-09-21 17:22:40 +00:00
|
|
|
module Api
|
|
|
|
module V2
|
|
|
|
class MappingsController < RestfulController
|
2016-10-04 05:51:07 +00:00
|
|
|
def searchable_columns
|
|
|
|
[]
|
|
|
|
end
|
2016-12-14 15:08:59 +00:00
|
|
|
|
|
|
|
def update
|
2016-12-14 17:58:47 +00:00
|
|
|
# hack: set the user temporarily so the model hook can reference it, then set it back
|
|
|
|
temp = resource.user
|
|
|
|
resource.user = current_user
|
2016-12-14 15:08:59 +00:00
|
|
|
update_action
|
|
|
|
respond_with_resource
|
2016-12-14 17:58:47 +00:00
|
|
|
resourse.user = temp
|
|
|
|
update_action
|
2016-12-14 15:08:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
# this is done so that the model hooks can use the mapping user to determine who took this action
|
|
|
|
resource.user = current_user if current_user.present? # current_user should always be present
|
|
|
|
destroy_action
|
|
|
|
head :no_content
|
|
|
|
end
|
2016-09-21 17:22:40 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|