https://avo.cool logo
Hey, friends: I have a resource with this asso...
# avo-2
m
Hey, friends: I have a resource with this association:
field :service_contracts, as: :has_many, link_to_resource: true
I am seeing this error:
ActionController::UnpermittedParameters - found unpermitted parameter: :turbo_frame:
This appears to be an internal Avo thing - searched the docs - any ideas?
m
Thread automatically created by hmasing in #740893011994738751
l
where do you see that? on which page?
m
Show page
l
otherwise, AFAIK that shouldn't impact the way Avo works
show page of the parent resource?
YEs
l
oh, so the problem is that you're getting Content missing
m
And the backend error is the unpermitted params above
l
do you have a resource for
service_contracts
?
also, what Avo version are you using?
m
class Avo::ServiceContractsController < Avo::ResourcesController end Empty controller
v2.34.5
l
that's fine
so that's happening when you just load the show page, right?
m
Yes
l
that's weird that it's happening
never saw it like that
l
Just to be sure, there is a resource for this controller?
l
like
class ServiceContractsResource
l
could you add
use_resource: ServiceContractsResource
to that field?
field :service_contracts, as: :has_many, link_to_resource: true, use_resource: ServiceContractsResource
m
FWIW, this happens on every resource with associations.
l
hmm
now that's weird
m
🙂 I agree!
l
Singular
ServiceContractResource
l
is this a greenfield app?
m
No
Adding on top of existing stack
l
did associations ever work?
m
Yes, a few months back when we first toyed with avo as our admin panel, but now I've got a dev going full time on it
l
Is there any monkey patch that can impact this?
m
I only have a few - and all are things like "pluralize a symbol" or "get a percentage of a Numeric"
l
or anything overriden in
Avo::ResourcesController
?
m
Nothing that touches Avo
l
I mean, any custom methods
m
No, plain vanilla
l
can you try to pinpoint the moment that they stopped working? maybe something changed along the way
I mean, if they worked, it's kind of strange to stop working just like that
I'd say that it's something that happened at some point
Was able to get this to log
l
hmmm
ok. something to work with
@loud-jewelry-99127 any ideas?
we remove that file recently, right?
l
The Avo version that @melodic-telephone-37659 is using should have it
l
did you override any of our View components? anything in the
/app/components/avo
directory?
m
No, don't even have that directory
We do use view components in our app, but they are namespaced into /app/frontend/components
l
so nothing inn
/app/frontend/components/avo
either, right?
m
Negative
l
hmmm
try
gem cleanup avo
and then
bundle install
again. maybe there's a dirty state somehow?
¯\_(ツ)_/¯
m
KK, trying now!
l
also, can you search for a
_flash
partial?
m
Just our own _flash partial
Same
l
was that there before Avo stopped working?
l
Also check if there is some code that renders a
_flash
partial that can be causing this
m
Refactoring out our internal _flash partial, one moment
Ahah... web | ActionView::MissingTemplate - Missing partial avo/associations/_flash_snackbar, avo/base/_flash_snackbar, avo/application/_flash_snackbar with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :jbuilder, :haml]}.
Renamed our flash 'flash_snackbar' and now this
l
my guess is that you have a piece of code trying to render it
and is getting the wrong path
m
So it looks like it's coming from our code. Yeah, this is super helpful. Digging in. I'll keep you posted
Found it
And now things work. Tada!
l
that layout is being used when the Avo code loads a turbo frame and that isn't available so it crashes
interesting bug
I was thinking of overriding that layout file, but now I'm cured of that pattern 😛
... to do the same thing BTW 😛
display flashes
m
We do use that for flash messages in the client-facing part of the app, so I'll need to figure out how to make that work
l
please let us know what you settle on. it's something that we'd like to refactor in our apps too
m
And likewise, if you find a solution and remember this conversation, I'm all ears!
l
sure
right now I use a partial that I include in each response
.turbo_stream.erb
file
definitely not the right thing to do
I think this can be fixe dif you use an absolute path
render 'something/deep/in/your/app/flash
this way when Avo tries to load it it will have the full path and won't choke
but, that will also mean you'd render the erros twice
hmmm
you need a conditional there.
Copy code
ruby
unless Avo
  render flash
end
unless controller.controller_name.starts_with? "Avo::
maybe
m
I'll try an absolute path, one sec
Abolute path fixes the issue
l
yes, but when you have an error in Avo, does that render the flash messages twice?
Checking for double render, one moment
No double render
l
cool! you should be good to go then 🙂
m
Thanks, guys!
l
anytime!
m
Glad this was, at least, a unique problem 🙂
Any idea why the service contracts and marketing agreements render differently?
Service Contracts show the Service Provider name, Marketing Agreements do not
the Service Contract Resource has:
Copy code
field :service_contracts, as: :has_many, link_to_resource: true
  field :marketing_agreements, as: :has_many, link_to_resource: true
l
The show page of that marketing agreement shows the service provider correctly?
m
Yes
l
The model associations coincide whit the resource associations?
Since you're on service provider show page, all related association table should omit the service provider column. Marketing agreements is looking great, would need to have a reproduction repoitory in order to debug this one
l
can you share the service provider resource config too?
l
Can you share the model association relevant configuration betwen
Service::Provider
-
Marketing::Agreement
/
Service::Provider
-
Service::Contract
?
m
Was a missing inverse_of on the Service::Contract. Thanks!
I appreciate the support, again! you guys are great.
I'll try to keep the questions down 😉
l
sometimes, when you have more code to show, a github issue might work better
m
Will do!
l
m
@loud-jewelry-99127 The attachment issue you were helping me with may be our old turbo_rails issue above....
LMK if a git issue would be easier
l
yes, please 🙏
m