Skip to content

Commit

Permalink
🐛 Fix Hyrax::ChangeSet.inspect method
Browse files Browse the repository at this point in the history
Prior to this, there was no reference to `model_class` meaning that
`Hyrax::ChangeSet.inspect` would raise an exception.

We need the binding of the `resource_class`, which is available during
the creation of the class but not afterwards.  In other words, by using
the `define_singleton_method` we can leverage the provided
`resource_class` as a bound value for the return value of `.inspect`.
  • Loading branch information
jeremyf committed Feb 5, 2024
1 parent fdcabe6 commit 0ee1b47
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/hyrax/change_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def self.ChangeSet(resource_class)

##
# @return [String]
def self.inspect
return "Hyrax::ChangeSet(#{model_class})" if name.blank?
define_singleton_method :inspect do
return "Hyrax::ChangeSet(#{resource_class})" if name.blank?
super
end
end
Expand Down

0 comments on commit 0ee1b47

Please sign in to comment.