Skip to content

Commit

Permalink
Merge pull request #929 from samvera/valk3-nondelegate
Browse files Browse the repository at this point in the history
Removing delegate in favor of explicit method
  • Loading branch information
tpendragon authored May 11, 2023
2 parents e97a08c + 5fa089e commit 440b75f
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 440b75f

Please sign in to comment.