如何在集合局部中渲染嵌套局部?

时间:2019-05-11 02:37:21

标签: ruby-on-rails

在我的topic / index.html.erb模板中,我有这个:

render partial: 'topics/topic', collection: @topics, as: :topic, cached: true

在这部分我里面:

<% cache topic do %>

  <%= render "shared/foo", topic: topic %>

<% end %>

在开发环境中,我看到以下日志(已禁用缓存):

Rendering topics/index.html.erb within layouts/application
Rendered shared/_foo.erb (0.8ms)
Rendered shared/_foo.erb (0.4ms)
Rendered shared/_foo.erb (0.3ms)
Rendered shared/_foo.erb (0.6ms)
...

这是正常现象还是我必须做其他事情?

0 个答案:

没有答案