2017-02-09 21:53:19 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-06 16:15:18 +00:00
|
|
|
|
2017-02-09 21:53:19 +00:00
|
|
|
module Api
|
|
|
|
module V2
|
|
|
|
class WithUpdatesController < RestfulController
|
|
|
|
def create
|
|
|
|
instantiate_resource
|
|
|
|
resource.user = current_user if current_user.present?
|
|
|
|
resource.updated_by = current_user if current_user.present?
|
|
|
|
authorize resource
|
|
|
|
create_action
|
|
|
|
respond_with_resource
|
|
|
|
end
|
|
|
|
|
|
|
|
def update
|
|
|
|
resource.updated_by = current_user if current_user.present?
|
|
|
|
update_action
|
|
|
|
respond_with_resource
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
resource.updated_by = current_user if current_user.present?
|
|
|
|
destroy_action
|
|
|
|
head :no_content
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|