From 5fa089ecf97a54e3e155ac61d3b0d535c8e1e9c1 Mon Sep 17 00:00:00 2001 From: Daniel Pierce Date: Thu, 11 May 2023 11:01:09 -0400 Subject: [PATCH] Removing delegate in favor of explicit method Co-authored-by: Jeremy Friesen --- lib/valkyrie/change_set.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/valkyrie/change_set.rb b/lib/valkyrie/change_set.rb index 0ca79db6b..45936f882 100644 --- a/lib/valkyrie/change_set.rb +++ b/lib/valkyrie/change_set.rb @@ -77,9 +77,11 @@ def [](key) send(key) if respond_to?(key) end - delegate :attributes, to: :resource - - delegate :internal_resource, :created_at, :updated_at, :model_name, :optimistic_locking_enabled?, to: :resource + [:internal_resource, :created_at, :updated_at, :model_name, :optimistic_locking_enabled?, :attributes].each do |method_name| + define_method(method_name) do |*args| + resource.public_send(method_name, *args) + end + end # Prepopulates all fields with defaults defined in the changeset. This is an # override of Reform::Form's method to allow for single-valued fields to