From 99c8cc4a849cbceb283cd90958035c5415bef38c Mon Sep 17 00:00:00 2001 From: Sam Handler Date: Tue, 21 Mar 2017 11:25:05 -0400 Subject: [PATCH] register replace_polymorphic_to_one_relationship callback --- lib/jsonapi/authorization/authorizing_processor.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jsonapi/authorization/authorizing_processor.rb b/lib/jsonapi/authorization/authorizing_processor.rb index 7bedefb2..ab2418cc 100644 --- a/lib/jsonapi/authorization/authorizing_processor.rb +++ b/lib/jsonapi/authorization/authorizing_processor.rb @@ -16,6 +16,11 @@ class AuthorizingProcessor < JSONAPI::Processor set_callback :replace_to_many_relationship, :before, :authorize_replace_to_many_relationship set_callback :remove_to_many_relationship, :before, :authorize_remove_to_many_relationship set_callback :remove_to_one_relationship, :before, :authorize_remove_to_one_relationship + set_callback( + :replace_polymorphic_to_one_relationship, + :before, + :authorize_replace_polymorphic_to_one_relationship + ) [ :find, @@ -216,6 +221,10 @@ def authorize_remove_to_one_relationship authorizer.remove_to_one_relationship(source_record, relationship_type) end + def authorize_replace_polymorphic_to_one_relationship + raise NotImplementedError + end + private def authorizer