Skip to content
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

Search by type on associations fields #3166

Closed
Paul-Bob opened this issue Aug 21, 2024 · 0 comments · Fixed by #3231
Closed

Search by type on associations fields #3166

Paul-Bob opened this issue Aug 21, 2024 · 0 comments · Fixed by #3231
Assignees
Labels
Bug Something isn't working Edge case It's not really a bug but an edge-case that might pop up from time to time.

Comments

@Paul-Bob
Copy link
Contributor

Paul-Bob commented Aug 21, 2024

Context

When there are two fields with the same ID, the current implementation does not distinguish between different field types. For example:

def fields
  field :speakers, as: :tags, hide_on: [:show, :forms] do
    record.speakers.map(&:name)
  end

  field :speakers, as: :has_many, through: :speaker_talks
end

When rendering the has_many field in the show view, we should search for fields based on both the ID (speakers) and the association type (has_many) to ensure the correct field is selected.

Since hide_on: [:show, :forms] is present on the tags field it should not even be taken into consideration when searching for fields on the show view.

Originally reported here.

@Paul-Bob Paul-Bob added Bug Something isn't working Edge case It's not really a bug but an edge-case that might pop up from time to time. labels Aug 21, 2024
@Paul-Bob Paul-Bob self-assigned this Aug 21, 2024
@Paul-Bob Paul-Bob added this to Issues Aug 21, 2024
@Paul-Bob Paul-Bob moved this to Next up in Issues Aug 21, 2024
@Paul-Bob Paul-Bob moved this from In Progress to In Review in Issues Sep 11, 2024
@github-project-automation github-project-automation bot moved this from In Review to Done in Issues Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Edge case It's not really a bug but an edge-case that might pop up from time to time.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant