Conversation
JuanVqz
reviewed
Apr 22, 2025
app/models/project.rb
Outdated
| def clone_stories_into(clone) | ||
| stories.each { |story| clone.stories.create(story.dup.attributes) } | ||
| stories.each do |story| | ||
| attrs = story.dup.attributes.except("status", "id", "created_at", "updated_at") |
Member
There was a problem hiding this comment.
JFI: we do not need to add the id, created_at, updated_at the dup method removed them already
Suggested change
| attrs = story.dup.attributes.except("status", "id", "created_at", "updated_at") | |
| attrs = story.dup.attributes.except(:status) |
In the other hand, I was wondering if instead of except attributes we would want to accept only the "clonable" attributes we need, I'm thinking towards the future when someone adds more attributes those will be cloned and maybe we don't want that, makes sense?
Member
Author
There was a problem hiding this comment.
Makes sense. I have updated.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Jira Ticket
https://ombulabs.atlassian.net/browse/STJ-14
Motivation / Context
Fix for #347
While cloning the stories, I have excluded status of the story alongside some other attributes. Wrote specs to check the behaviour.
QA / Testing Instructions
How do I achieve this behavior? Use the following format to provide a step-by-step guide:
Step 1: create a project and approve/reject some stories
Step 2: clone it
Step 3: new project has some stories, all of them marked as pending.
Screenshots:
I will abide by the code of conduct.