-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Rename Poll::Question::Answer to Poll::Question::Option #5537
Open
javierm
wants to merge
5
commits into
master
Choose a base branch
from
rename_question_answer_to_option
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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
javierm
force-pushed
the
rename_question_answer_to_option
branch
from
May 13, 2024 23:20
433ed8f
to
a4779f5
Compare
We were using three different variable names for the same thing, in consecutite tests.
Not sure about when we stopped needing them, but all usages of require_dependency definitely become obsolete after we started using Zeitwerk in commit 5f24ee9. We're also going to rename `Poll::Question::Answer` to `Poll::Question::Option`, so the conflict of having two `Answer` classes, that made us add this code in the first place, will not even exist.
Just like we do every else (even on that very same file), we use the method instead of the instance variable.
Having a class named `Poll::Question::Answer` and another class named `Poll::Answer` was so confusing that no developer working on the project has ever been capable of remembering which is which for more than a few seconds. Furthermore, we're planning to add open answers to polls, and we might add a reference from the `poll_answers` table to the `poll_question_answers` table to property differentiate between open answers and closed answers. Having yet another thing named answer would be more than what our brains can handle (we know it because we did this once in a prototype). So we're renaming `Poll::Question::Answer` to `Poll::Question::Option`. Hopefully that'll make it easier to remember. The name is also (more or less) consistent with the `Legislation::QuestionOption` class, which is similar. We aren't changing the table or columns names for now in order to avoid possible issues when upgrading (old code running with the new database tables/columns after running the migrations but before deployment has finished, for instance). We might do it in the future. At first I tried not to change the internationalization keys either so existing translations would still be valid. However, since we have to change the keys in `activerecord.yml`, since it uses class names and we're changing the class names, we're changing them everywhere for consistency. Note that it isn't clear whether we should use `option` or `question_option` in some cases. In order to keep things simple, we're using `option` where we were using `answer` and `question_option` where we were using `question_answer`.
javierm
force-pushed
the
rename_question_answer_to_option
branch
from
May 17, 2024 20:50
a4779f5
to
3284871
Compare
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.
Objectives
Poll::Answer
class doesRelease notes
Poll::Question::Answer
model toPoll::Question::Option
. If you've got some custom codes dealing with polls, you might have to update it. For now, we are not renaming the related database tables in order to make the upgrade easier.