From 827ac62bdb4caf4ba84bd9d3697f41b38a0d2735 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 4 Sep 2021 15:29:30 +0200 Subject: [PATCH 1/2] Remove debug output --- lib/trailblazer/endpoint/controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trailblazer/endpoint/controller.rb b/lib/trailblazer/endpoint/controller.rb index 06de51b..b42ce90 100644 --- a/lib/trailblazer/endpoint/controller.rb +++ b/lib/trailblazer/endpoint/controller.rb @@ -58,7 +58,7 @@ def self.included(includer) module Rails module Process def send_action(action_name) - puts "@@@@@>>>>>>> #{action_name.inspect}" + # puts "@@@@@>>>>>>> #{action_name.inspect}" dsl = send(action_name) # call the actual controller action. From 0d58b7d09371e71bc9325bb6d380a01b12f4b140 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Sat, 27 Apr 2024 21:16:06 +0200 Subject: [PATCH 2/2] Fix: ctx can be nil when calling `puts @normalizers[:endpoints].call([]).inspect` in a controller Stacktrace: /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.3.0/bundler/gems/trailblazer-endpoint-827ac62bdb4c/lib/trailblazer/endpoint/options.rb:80:in `block in CallDirective': no implicit conversion of nil into Hash (TypeError) config = callable.(ctx, **ctx) # e.g. ApplicationController.options_for_endpoint --- lib/trailblazer/endpoint/options.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/trailblazer/endpoint/options.rb b/lib/trailblazer/endpoint/options.rb index e3155cc..9acb9fe 100644 --- a/lib/trailblazer/endpoint/options.rb +++ b/lib/trailblazer/endpoint/options.rb @@ -77,6 +77,7 @@ def self.add(normalizer, directive_name, options) def self.CallDirective(callable, option_name) ->((ctx, flow_options), *) { + ctx ||= {} config = callable.(ctx, **ctx) # e.g. ApplicationController.options_for_endpoint # ctx[option_name] = ctx[option_name].merge(config)