Skip to content

Commit

Permalink
Removing delegate in favor of explicit method
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Friesen <[email protected]>
  • Loading branch information
dlpierce and jeremyf committed May 11, 2023
1 parent e97a08c commit 5fa089e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/valkyrie/change_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5fa089e

Please sign in to comment.