开发者

Render cached action of another controller inside erb template

开发者 https://www.devze.com 2023-01-14 04:12 出处:网络
I want to render action inside my erb template. <div> <%= render :controller => :tags, :action =&g开发者_StackOverflow中文版t; :tag_cloud %>

I want to render action inside my erb template.

<div>
  <%= render :controller => :tags, :action =&g开发者_StackOverflow中文版t; :tag_cloud %>
</div>

This block throws exception: undefined method `formats' for nil:NilClass

Also I want to tag_cloud action to be rendered from cache. Is that possible?

Regards, Alexey Zakhaov


Just remind that render :action does not run the tags controller, it just renders the tag_cloud erb with the variables you have defined in your current controller. So you have to define in your controller all the instance variables you need in your template, including the one on which the formats method is called.

0

精彩评论

暂无评论...
验证码 换一张
取 消