Parameters q global false via
# avo-2
c
Parameters: {"q"=>"", "global"=>"false", "via_association"=>"has_many", "via_association_id"=>"authors", "via_reflection_class"=>"Book", "via_reflection_id"=>"the-hobbit", "resource_name"=>"authors"}
l
hey 👋
c
Hey Adrian
l
c
Search would result in this error: ActiveRecord::RecordNotFound (Couldn't find Book with 'id'=the-hobbit):
l
the demo site is using fridnely id for users
it's Avo 3, but should behave the same
I remember working in Avo 2 as well
can you share a reproduction repo so we can check it out?
c
Well, nuts. The resources all display and search independntly.
l
... on a GitHub issue 😅
this is weird
can you share your resource file?
c
I am removing some of the fields to shorten it: https://gist.github.com/davekruse/7e4f9603831b20f4c0c24225e6ac6896
l
and when do you get that error?
ooh
I see it
in your ransack you have
id_eq: params[:q]
you shoudl remove that
hmmm. actually...
nope. that's not it
c
as soon as I click the search on the has_many index.
l
so you're on a page of a different resource that has school as a has_many?
and you click on the search for schools?
c
I'm on the school page. As soon as I click on the search of a has many, it fails.
l
hmm
ok. let me try
got it!
c
Hang on... lemme give you a new gist. I'm going to remove everything to isolate just the record and a has_many.
oh?
l
no need. thanks
I managed to reproduce it
so the seearch controller can't find the original record by the friendly id
let me create an issue (which I invite you to do next time 😅)
c
☝️
That's what I'm seeing. Yep.
l
thanks for reaching out
c
sweet, thanks.
I have another I will add an issue for when I have a moment. It's regarding attaching when a resource has a resolve_query_scope (ie. users with a role of editor). The push fails (<<) in the associations_controller because the association is a AssociationRelation, not a CollectionProxy. More on that in the issue.
l
got it
thanks for diving deep into these
it helps!
c
thanks for responding! that's super helpful!