-
-
Notifications
You must be signed in to change notification settings - Fork 298
Description
Describe the bug
I have a resource that has a :has_many
field, and in that associated resource is a :belongs_to
with searchable: true
. When I click that field to search, the search results list gives no results and only says "undefined method preview?
for nil".
The rest of the nest form works and saves just fine, although this is the only field that you search for. If I go to the index page of the resource and do the search there, it works just fine. It's only searching from within that nested form where it breaks.
I've tried to follow this down as far as I can and I've gotten to this point--the HTML rendered for the search is
<div class="w-full hidden" data-search-target="autocomplete" data-search-resource="instructors" data-translation-keys="{
"no_item_found": "No record found",
"cancel_button": "Cancel"
}" data-via-association="belongs_to" data-via-association-id="instructor" data-via-reflection-id="5f3bdedd-bb8a-42cf-aa73-a00d851e25ca" data-via-reflection-class="CourseSection" data-via-reflection-view="" data-via-parent-resource-id="" data-via-parent-resource-class="" data-via-relation="">
...
</div>
The problem seems to be that the data-via-reflection-view
attribute is empty for this form, where normally I see it set to edit
or something. If I manually edit the HTML and set that attribute, the search now works.
So the question is, why isn't that attribute being set?
Reproduction repository for the bug
I don't have one--in fact, I tried to set up a minimal example with a fresh copy of Avo and it worked fine. It's possible that it's something specific to my app that is causing this, or that it's a valid but untested configuration that is causing problems.
I understand you can't go off chasing something that you can't repro, but I'm hoping that's enough info that you might be able to see why the view info isn't being passed along.
If not, or even if you have an idea of something I can go back and test in my app, any help is appreciated.
System configuration
Avo version: 3.24.1
Rails version: 7.2.2.2
Ruby version: 3.3.1
License type:
- Community
- Pro
- Advanced
Are you using Avo monkey patches, overriding views or view components?
- Yes. If so, please post code samples.
- No
Screenshots or screen recordings

Additional context
Impact
- High impact (It makes my app un-usable.)
- Medium impact (I'm annoyed, but I'll live.)
- Low impact (It's really a tiny thing that I could live with.)
Urgency
- High urgency (I can't continue development without it.)
- Medium urgency (I found a workaround, but I'd love to have it fixed.)
- Low urgency (It can wait. I just wanted you to know about it.)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status