From 7dd759558b69ee04528a20d71b72a080403ad80c Mon Sep 17 00:00:00 2001 From: Campbell Allen Date: Mon, 29 Jun 2015 18:25:04 +0100 Subject: [PATCH] skip authenticity token check for events api --- app/controllers/api/events_controller.rb | 2 ++ app/controllers/application_controller.rb | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/controllers/api/events_controller.rb b/app/controllers/api/events_controller.rb index 543fdd0a5..5cb5294df 100644 --- a/app/controllers/api/events_controller.rb +++ b/app/controllers/api/events_controller.rb @@ -2,6 +2,8 @@ module Api class EventsController < ApplicationController + skip_before_action :verify_authenticity_token, if: :json_request? + KNOWN_EVENTS = %w( activity workflow_activity ) def self.resource_name diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1687f0342..c0b9eb6fd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -35,4 +35,8 @@ def configure_permitted_parameters def paper_trail_enabled_for_controller false end + + def json_request? + request.format.json? + end end