Skip to content

Deleter must exist - AR-51 branch - With paranoia gem #32

@allhailskippy

Description

@allhailskippy

In the AR-51 branch, when Rails.application.config.active_record.belongs_to_required_by_default is set to true (which it is by default), and when using paranoia v2 for soft deletes, you cannot save the record because it is expecting deleter to be set (which it shouldn't be unless you are deleting it)

Could possibly be fixed by changing lib/active_record/userstamp/stampable.rb line 87 to include the optional: true as part of the merge.

belongs_to :deleter, relation_options.reverse_merge(foreign_key: config.deleter_attribute, optional: true) if associations.third

Metadata

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