开发者

Render cached action of another controller inside erb template

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜