jbuilder icon indicating copy to clipboard operation
jbuilder copied to clipboard

jBuilder 2.11.3, Rails 6.1.4.1 fail to render objects that are child of Simpledelegator

Open net1957 opened this issue 3 years ago • 2 comments

In my case, the objects rendered are child of Simpledelegator Class

I get this error as soon I add cached: true to my json.jbuilder view: ActionView::Template::Error (undefined method nhut' for [#<Cmdmary::Etudprix`

The Cmdmary::Etudprix is the AR object and not the Decorated object (that define nhut) passed to the json.

Jbuilder use also Delegator if cached is true. Perhaps this colide with mine?

Without cached: true, all is working without problem. Any advice how to make this work?

net1957 avatar Nov 24 '21 20:11 net1957

I have to correct. It fail always wit or without cache;

in fact the error seem's to be a bit bad! image

the partial is: json.CdpHut do json.Hut cdplist.nhut json.Dmaj cdplist.dmaj json.Dtransfer cdplist.dexport end

if I pass directly a AR record it's working as expected with or without cache: true

So I think that the object (that have SimpleDelegatot in parents class) I'm passing is not supported.

but it work if I don't use partials: image

net1957 avatar Nov 25 '21 22:11 net1957

Can you provide an example application that reproduce the issue?

rafaelfranca avatar Dec 21 '21 03:12 rafaelfranca