Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow multiple relations; #342

Closed
wants to merge 1 commit into from
Closed

Conversation

gabrielms
Copy link

Allow multiple relations sending them as array of hashes.

self.audit_comment = nil
run_callbacks(:audit) { audits.create(attrs) } if auditing_enabled
audits_associated = audit_associated_with.is_a?(Array) ? audit_associated_with : [audit_associated_with]
audits_associated.each do |audit_associated|
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this create multiple, duplicate audits, one for each associated object? Though it's more complex, I think it'd make more sense for one audit to exist per event, but to change to the schema to have multiple associations.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @domcleal.

You are probably right. I had no time to take a better look and study the audited gem. I've made this because i needed in a project of mine.
It worked but i agree with you that this is not the right way of doing it. :(

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.

None yet

2 participants