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
I'm using Rails 7.0.6 and CPK 14.0.6 and have an ActiveRecord with a has_many association on a CPK ActiveRecord. The has_many is defined with dependent: :destroy, and when I attempt to destroy the parent ActiveRecord, one of the has_many CPK records fails to destroy. This causes Rails 7 to raise a TypeError.
The cause of the TypeError is in ~/.rvm/gems/ruby-3.2.0/gems/activerecord-7.0.6/lib/active_record/persistence.rb#_raise_record_not_destroyed():
key = self.class.primary_key
raise @_association_destroy_exception || RecordNotDestroyed.new("Failed to destroy #{self.class} with #{key}=#{send(key)}", self)
The TypeError is caused in the RecordNotDestroyed.new call because key is the CPK array of keys, so the send(key) call complains that key is not a symbol nor a string.
(I don't see why the Rails 7 code doesn't just call self.id, because this works, of course.)
The text was updated successfully, but these errors were encountered:
Interesting that the test cases don't catch this. Can you provide the Active Record definitions applicable to this bug? Does any test case look similar?
I'm using Rails 7.0.6 and CPK 14.0.6 and have an ActiveRecord with a has_many association on a CPK ActiveRecord. The has_many is defined with dependent: :destroy, and when I attempt to destroy the parent ActiveRecord, one of the has_many CPK records fails to destroy. This causes Rails 7 to raise a TypeError.
The cause of the TypeError is in ~/.rvm/gems/ruby-3.2.0/gems/activerecord-7.0.6/lib/active_record/persistence.rb#_raise_record_not_destroyed():
The TypeError is caused in the RecordNotDestroyed.new call because key is the CPK array of keys, so the send(key) call complains that key is not a symbol nor a string.
(I don't see why the Rails 7 code doesn't just call self.id, because this works, of course.)
The text was updated successfully, but these errors were encountered: