-
Couldn't load subscription status.
- Fork 32
Add additional question text fields to form parameters #1888
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
base: production
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors the form parameter handling in the Admin::FormsController to dynamically support up to 30 question text fields instead of hardcoding individual parameters. It also cleans up duplicate gem declarations in the Gemfile.
- Replaced hardcoded
:question_text_01through:question_text_20parameters with a dynamic approach using a range and mapping - Added a
MAX_QUESTIONSconstant set to 30 to define the upper limit for supported questions - Removed duplicate gem declarations in the Gemfile and fixed a typo in a comment
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/controllers/admin/forms_controller.rb | Refactored form parameters to dynamically generate question text fields up to MAX_QUESTIONS limit |
| Gemfile | Cleaned up duplicate gem declarations and fixed comment typo |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| :question_text_18, | ||
| :question_text_19, | ||
| :question_text_20, | ||
| *((1..MAX_QUESTIONS).map { |i| :"question_text_#{i.to_s.rjust(2, '0')}" }), |
Copilot
AI
Sep 2, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dynamic parameter generation creates a new array on every request. Consider memoizing this result or defining it as a constant to avoid repeated computation.
Update HTTP status codes across controllers from :unprocessable_entity to :unprocessable_content to align with RFC 9110 standards. Also add RSpec profiling and ignore examples.txt file.
…ust error status codes in SubmissionsController; modify question limit in Form model; enhance accessibility in question type view.
…ecord, storage, and support versions to 8.0.2.1; upgrade various gem dependencies
…tent in submissions_controller
…tity in submissions_controller
This pull request extends the permitted parameters in the
form_paramsmethod of theAdmin::FormsControllerto support additional question fields. This change allows the controller to handle up to 30 question text inputs in forms, increasing flexibility for larger forms.Form parameter extension:
:question_text_21through:question_text_30in theform_paramsmethod inapp/controllers/admin/forms_controller.rb, allowing forms to include up to 30 questions.