Skip to content

Permanent_records and Rails Engines failure  #109

Open
@Anuta555

Description

I have a model Productable that has_many products with dependent: :destroy
I have a model Product in both the main app and in the engine.
I have other models in the engine that belong_to Product

When my productable gets destroyed, product gets destroyed too - both hard deleted.
However, product has deleted_at column.

I have a before_destroy hook on the Product model, which triggers an event in the Engine, that in turn, removes something that belongs_to the Product in the engine.

This event from the main app the Product model, for some reason, is triggered twice - and that's the error. Why is the before_destroy hook on the Product is triggered twice?

Removing the gem eliminated the error - so it definitely has something to do with how the gem works with the Rails engines.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions