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

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

Open
net1957 opened this issue Nov 24, 2021 · 2 comments

Comments

@net1957
Copy link

net1957 commented Nov 24, 2021

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 net1957 changed the title jBuilder 2.11.3, Rails 6.1.4.1 wirh cached; true fil to render onjects that are child of Simpledelegator jBuilder 2.11.3, Rails 6.1.4.1 wirh cached: true fail to render onjects that are child of Simpledelegator Nov 24, 2021
@net1957 net1957 changed the title jBuilder 2.11.3, Rails 6.1.4.1 wirh cached: true fail to render onjects that are child of Simpledelegator jBuilder 2.11.3, Rails 6.1.4.1 wirh cached: true fail to render objects that are child of Simpledelegator Nov 24, 2021
@net1957 net1957 changed the title jBuilder 2.11.3, Rails 6.1.4.1 wirh cached: true fail to render objects that are child of Simpledelegator jBuilder 2.11.3, Rails 6.1.4.1 fail to render objects that are child of Simpledelegator Nov 25, 2021
@net1957
Copy link
Author

net1957 commented Nov 25, 2021

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

@rafaelfranca
Copy link
Member

Can you provide an example application that reproduce the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants