Fix UserDashboard id field type after UUID migration#225
Merged
Conversation
UserDashboard declared id: Field::Number, which calls Float() on the value. After the users.id migration to uuid in #223, visiting /admin raised "invalid value for Float(): \"<uuid>\"" before any rows could render. Switching to Field::String (matching ApiRequestLogDashboard) lets Administrate render the UUID as plain text. Verified end-to-end: GET /admin and every dashboard introduced in #223 (/admin/users, /admin/api_request_logs, /admin/daily_overview, /admin/requests_dashboard, /admin/api_error_logs, /admin/user_analytics, /admin/user_lookup, /admin/request_logs_by_payload) return 200. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Override after_sign_in_path_for in ApplicationController so that a User with admin? lands on admin_root_path. Non-admin users continue to use Devise's default (stored_location_for or root_path via super). Verified manually: signing in as admin@email.com returns 303 to http://localhost:3002/admin. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Follow-up to #223. After migrating `users.id` to UUID, visiting `/admin` raised:
```
invalid value for Float(): "0518a959-ac58-4a71-9fe5-448510a1478f"
```
Cause: `UserDashboard` declared `id: Field::Number`, which Administrate renders by calling `Float()` on the value. UUIDs aren't coercible to floats, so the index page crashed before rendering any rows.
Fix: change to `Field::String` (matching how `ApiRequestLogDashboard` already represents its UUID id).
Test plan
🤖 Generated with Claude Code