-
Notifications
You must be signed in to change notification settings - Fork 3
Hotfix for using subproviders #1182
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,9 @@ | |
| <div class="modal-body" id="activities_modal"> | ||
| <%= f.input :name, label: 'Naam', placeholder: 'Naam', required: true %> | ||
| <%= f.input :email, label: 'E-mailadres', placeholder: 'E-mailadres', required: true %> | ||
| <% if Rails.application.config.x.subprovider_label.present? %> | ||
| <%= f.input :sub_provider, label: 'Subprovider', placeholder: Rails.application.config.x.subprovider_label, required: true, input_html: { style: 'text-transform: uppercase;', onkeyup: 'this.value = this.value.toUpperCase();' } %> | ||
| <% end %> | ||
|
Comment on lines
+16
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check User model for sub_provider validations
echo "=== Searching for sub_provider validations in User model ==="
rg -n 'validates.*sub_provider|presence.*sub_provider' app/models/ || echo "No validates directive found"
# Check for sub_provider in entire models directory
echo "=== All sub_provider references in models ==="
rg -n -B 2 -A 2 'sub_provider' app/models/ || echo "No sub_provider references found"
# Check for uppercase/upcase handling for sub_provider
echo "=== Checking for uppercase normalization ==="
rg -n -B 2 -A 2 'upcase|uppercase' app/models/ app/controllers/ | grep -A 2 -B 2 'sub_provider\|provider' || echo "No uppercase handling found"
# List the edit modal file to verify it exists
echo "=== Checking edit modal file ==="
fd '_edit_sofia_account_modal' app/views/users/
# Check sub_provider in edit modal
echo "=== Checking if sub_provider exists in edit modal ==="
if [ -f "app/views/users/_edit_sofia_account_modal.html.erb" ]; then
rg -n 'sub_provider' app/views/users/_edit_sofia_account_modal.html.erb || echo "No sub_provider found in edit modal"
else
echo "Edit modal file not found"
fi
# Get context of the new modal around the sub_provider field
echo "=== Context of new modal (lines 14-20) ==="
sed -n '14,20p' app/views/users/_new_sofia_account_user_modal.html.erbRepository: csvalpha/sofia Length of output: 1048 🏁 Script executed: #!/bin/bash
# Check User model file to see full structure
echo "=== User model existence ==="
fd 'user.rb' app/models/ | head -5
# Check if sub_provider is an accessor or attribute
echo "=== Checking User model for sub_provider attribute/accessor ==="
rg -n 'attr_|sub_provider' app/models/user.rb
# Check strong parameters/permit list in controller
echo "=== Checking controller for sub_provider in params permit ==="
rg -n -B 3 -A 3 'permit.*sub_provider|params\[:user\]' app/controllers/ | grep -B 3 -A 3 'sub_provider\|user_params' || echo "Checking for user controller..."
# Find user-related controllers
echo "=== Finding user-related controllers ==="
fd 'users_controller' app/controllers/Repository: csvalpha/sofia Length of output: 1300 🏁 Script executed: #!/bin/bash
# Read the entire User model
echo "=== Full User model ==="
head -80 app/models/user.rb
# Check for database schema/migrations
echo "=== Checking schema for sub_provider column ==="
rg -n 'sub_provider' db/schema.rb || echo "Not in schema.rb"
# Check recent migrations for sub_provider
echo "=== Checking migrations for sub_provider ==="
fd 'migrate' db/migrate | xargs rg -l 'sub_provider' | head -5
# If migrations found, show content
echo "=== Migration content ==="
fd 'migrate' db/migrate | xargs rg -B 2 -A 2 'sub_provider' || echo "No sub_provider in migrations"Repository: csvalpha/sofia Length of output: 6123 Add presence validation and backend normalization for sub_provider field The sub_provider field is now in the new modal with required: true, but the User model lacks critical backend safeguards:
Add to the User model: validates :sub_provider, presence: true, if: -> { Rails.application.config.x.subprovider_label.present? }
before_save { self.sub_provider = sub_provider.upcase if sub_provider.present? }Remove the 🤖 Prompt for AI Agents |
||
| </div> | ||
|
|
||
| <div class="modal-footer"> | ||
|
|
||
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 label for the sub_provider field uses 'Subprovider', but in the code that was removed from the edit modal, it was 'SubProvider' (with capital P). This inconsistency should be corrected to match the original capitalization for consistency.