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

Properly using #dup method for expected behavior: #522

Conversation

vanessuniq
Copy link
Contributor

* Before: dup method was applied to a list of ActiveRecord objects, which was making a shallow copy of the array without creating new records for the objects within the array. So e.g: assigning a list of checks [belonging to rule B] to rule A disassociate the checks from rule B, updating the foreign key to rule A id.
* Fix: updated the logic to get the list of duplicated [new records] activeRecord model objects `map(&:dup)`.

Signed-off-by: Vanessa Fotso vfotso@mitre.org

	* Before: dup method was applied to a list of ActiveRecord objects, which was making a shallow copy of the array without creating new records for the objects withing the array. So e.g: assigning a list of checks [belonging to rule B] to rule A disassociate the checks from rule B, updating the foreign key to rule A id.
	* Fix: updated the logic to get the list of duplicated [new records] activeRecord model objects.

Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
@vanessuniq vanessuniq added the bug Something isn't working label Jan 20, 2023
@vanessuniq vanessuniq temporarily deployed to vulcan-pr-522 January 20, 2023 04:27 Inactive
@vanessuniq vanessuniq temporarily deployed to vulcan-pr-522 January 20, 2023 20:51 Inactive
rlakey
rlakey previously approved these changes Jan 21, 2023
Copy link
Contributor Author

@vanessuniq vanessuniq left a comment

Choose a reason for hiding this comment

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

Thanks for adding descriptions. Please run rubocop -A and yarn lint commands before pushing codes.

@vanessuniq vanessuniq temporarily deployed to vulcan-pr-522 January 23, 2023 15:05 Inactive
rlakey
rlakey previously approved these changes Jan 23, 2023
Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
…to :capabilities

Signed-off-by: Vanessa Fotso <vfotso@mitre.org>
@vanessuniq vanessuniq temporarily deployed to vulcan-pr-522 January 23, 2023 16:03 Inactive
@vanessuniq vanessuniq enabled auto-merge (squash) January 23, 2023 16:09
@vanessuniq vanessuniq merged commit 73be75d into master Jan 23, 2023
@vanessuniq vanessuniq deleted the 515-copy-component-corrupts-srg-data-when-updating-srg-version-of-the-new-srg branch January 23, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Copy Component corrupts SRG data when updating SRG version of the new SRG
3 participants