Skip to content

Conversation

@rileyseaburg
Copy link
Contributor

This pull request extends the permitted parameters in the form_params method of the Admin::FormsController to 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:

  • Added support for :question_text_21 through :question_text_30 in the form_params method in app/controllers/admin/forms_controller.rb, allowing forms to include up to 30 questions.

@rileyseaburg rileyseaburg self-assigned this Sep 2, 2025
Copilot AI review requested due to automatic review settings September 2, 2025 15:47

This comment was marked as outdated.

@rileyseaburg rileyseaburg requested a review from Copilot September 2, 2025 15:56
Copy link
Contributor

Copilot AI left a 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_01 through :question_text_20 parameters with a dynamic approach using a range and mapping
  • Added a MAX_QUESTIONS constant 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')}" }),
Copy link

Copilot AI Sep 2, 2025

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.

Copilot uses AI. Check for mistakes.
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
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.

2 participants