Skip to content

Conversation

@koppen
Copy link
Member

@koppen koppen commented Oct 31, 2025

Each Field could benefit from knowing the Repository they're a part of

When editing a field we occasionally need to know the record being
edited to properly render the field (for example to set default values
based on other field values) or when listing options for a select field.
Copilot AI review requested due to automatic review settings October 31, 2025 14:37
It is actually the repository we need to know for each field, much more
than the individual record.
@koppen koppen force-pushed the add_record_to_fields branch from e66613a to c0c7925 Compare October 31, 2025 14:37
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 PR adds a repository accessor to the Field class and sets it when retrieving fields for different views (edit, index, show). However, there's an inconsistency in how the fields_for_edit method signature is being updated.

  • Added repository attribute to Field class to associate fields with their repository
  • Modified fields_for_edit, fields_for_index, and fields_for_show to set the repository on each field
  • Updated test and controller to pass a record parameter to fields_for_edit

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/uchi/field.rb Added repository accessor attribute to Field class
lib/uchi/repository.rb Modified field retrieval methods to set repository on each field
test/uchi/repository_test.rb Updated test to pass author record to fields_for_edit
app/controllers/uchi/repository_controller.rb Updated controller to pass record to fields_for_edit

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@koppen koppen requested a review from olepalm October 31, 2025 14:54
@koppen koppen merged commit 784c8fe into main Oct 31, 2025
3 checks passed
@koppen koppen deleted the add_record_to_fields branch October 31, 2025 15:29
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