当我有 2 个片段缓存相同查询但以不同方式显示它们的视图时,只有一个片段并且它们都以相同的方式显示。有没有办法解决?例如...
#views/posts/list
- cache(@posts) do
- for p in @posts
= p.title
#views/posts/list_with_images
- cache(@posts) do
- for p in @posts
= p.title
= p.content
= image_tag(p.image_url)
#controllers/posts_controller
def list
...
@posts = Post.all
end
def list_with_images
...
@posts = Post.all
end