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
Hi, this is more like a question not a real issue, it's because of a bug that was driving me crazy.
We had some resources that were raising some foreign key exceptions:
PG::ForeignKeyViolation: ERROR: update or delete on table "a" violates foreign key constraint "fk_rails_f207f40ee2" on table "b"
For some reason, calling really_destroy! was not destroying associations it was just updating it's deleted_at column but this was only happening on one association (all of the associations have dependent :destroy), after a lot of debugging and testing I realized that in a bad merge (probably) we had a duplicate call to acts_as_paranoid so we had.
Class A < ActiveRecord::Base
acts_as_paranoid
acts_as_paranoid
end
I then took one of those calls out, and then it all started working properly.
I opened up the source code to try to understand what the heck was going on, and why having that double call to acts_as_paranoid makes the association to be soft deleted instead of really destroyed.
So that's why I'm here, just trying to understand what's happening and in case somebody else has an issue like this.
Rails 4.2.11.1
Paranoia 2.4.1
The text was updated successfully, but these errors were encountered:
Hi, this is more like a question not a real issue, it's because of a bug that was driving me crazy.
We had some resources that were raising some foreign key exceptions:
PG::ForeignKeyViolation: ERROR: update or delete on table "a" violates foreign key constraint "fk_rails_f207f40ee2" on table "b"
For some reason, calling
really_destroy!
was not destroying associations it was just updating it'sdeleted_at
column but this was only happening on one association (all of the associations have dependent :destroy), after a lot of debugging and testing I realized that in a bad merge (probably) we had a duplicate call toacts_as_paranoid
so we had.I then took one of those calls out, and then it all started working properly.
I opened up the source code to try to understand what the heck was going on, and why having that double call to
acts_as_paranoid
makes the association to be soft deleted instead of really destroyed.So that's why I'm here, just trying to understand what's happening and in case somebody else has an issue like this.
Rails 4.2.11.1
Paranoia 2.4.1
The text was updated successfully, but these errors were encountered: