1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/app/controllers/api/abuses_controller.rb

23 lines
588 B
Ruby
Raw Normal View History

2019-01-08 09:56:07 +01:00
# frozen_string_literal: true
# API Controller for resources of type Abuse.
# Typical action is an user reporting an abuse on a project
2016-03-23 18:39:41 +01:00
class API::AbusesController < API::ApiController
before_action :authenticate_user!, except: :create
def create
@abuse = Abuse.new(abuse_params)
if @abuse.save
render status: :created
else
render json: @abuse.errors.full_messages, status: :unprocessable_entity
end
end
private
def abuse_params
params.require(:abuse).permit(:signaled_type, :signaled_id, :first_name, :last_name, :email, :message)
end
end