You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ChangeSets inherit a #save method from Reform/Disposable which call #sync on the change set and #save on the resource. Since Valkyrie resources do not have a #save method, this raise undefined method exception. It would be better for this to raise a more meaningful exception that provides information on how to avoid the exception.
Rational
Provide developers with information on how to avoid exceptions.
Expected behavior
Calling change set #save method should throw...
NoMethodError (undefined method `save' for #<_ChangeSet_>)
OR something more descriptive...
NoMethodError (undefined method `save' for #<_ChangeSet_>); call #sync method on change set and then use persister to save resource
Actual behavior
Calling change set #save method throws...
NoMethodError (undefined method `save' for #<_Resource_>)
To reproduce
# frozen_string_literal: true
class Book < Valkyrie::Resource
attribute :title, Valkyrie::Types::Set.of(Valkyrie::Types::String).meta(ordered: true)
end
# frozen_string_literal: true
class BookChangeSet < Valkyrie::ChangeSet
property :title
end
book = Book.new
book_cs = BookChangeSet.new(book)
book.title = 'test title'
book_cs.save # NoMethodError (undefined method `save' for #<Book:0x00007fafcea8c278>)
The text was updated successfully, but these errors were encountered:
Description
ChangeSets inherit a #save method from Reform/Disposable which call #sync on the change set and #save on the resource. Since Valkyrie resources do not have a #save method, this raise undefined method exception. It would be better for this to raise a more meaningful exception that provides information on how to avoid the exception.
Rational
Provide developers with information on how to avoid exceptions.
Expected behavior
Calling change set #save method should throw...
OR something more descriptive...
Actual behavior
Calling change set #save method throws...
To reproduce
The text was updated successfully, but these errors were encountered: