Skip to content

Fix callbacks not being created when updating audit options#751

Open
chaadow wants to merge 1 commit intocollectiveidea:mainfrom
chaadow:fix_callbacks_on_audited_update
Open

Fix callbacks not being created when updating audit options#751
chaadow wants to merge 1 commit intocollectiveidea:mainfrom
chaadow:fix_callbacks_on_audited_update

Conversation

@chaadow
Copy link
Copy Markdown

@chaadow chaadow commented Dec 24, 2024

The main use case is that audited allows users to update the audited options by calling audited multiple times.

# This create two callbacks `after_update` and `after_destroy`
audited on: [:update, :destroy]

# Now if we call audited a second time
# this unfortunately won't create the `after_create` callback when updating the configuration
audited on: [:update, :destroy, :create]

This pull requests fixes the issue so that it creates callbacks only for added configuration, in the example above it's the create one.

@amkisko
Copy link
Copy Markdown

amkisko commented Jan 7, 2025

Hey! Does this happen when you inherit the base class with audited call?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants