I have this piece of code in a partial on some code for rails 2.3.14:
<% cache "some_partial_#{some_id}" do %>
....
<% end %>
Works fine when rendering it in a view but I get:
undefined method `fragment_for' for nil:NilClass
when I try to do this in a model:
ActionView::Base.new("app/views").render(:partial => "home/temp"}
I can see the issue occuring in actionpack-2.3.14/lib/action_view/helpers/cache_helper.rb:35
def cache(name = {}, options = nil, &block)
@controller.fragment_for(output_buffer, name, options, &block)
end
I'm not sure what exactly it expects to find in @controller.