How to pass multiple locals to a nested partial

倖福魔咒の 提交于 2019-12-04 12:49:46

After finding out that the code was run twice, I went investigating who else was running it.

and I realized that just few lines before there was the call to cocoon function link_to_add_association

of course it's not only the official render rendering the partial but also that function needs to render it.

I have added the line:

:render_options => {:locals => {:step => step }},

to my link_to_add_association function call and removed the workaround and now everything works as expected.

The more modern version analogous to this would be:

render_options: {locals: {step: step }},

a bit shorter, and looking better.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!