Forum: Ruby on Rails Fragment Cache in ActionMailer

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Hugh (Guest)
on 2007-01-25 18:33
(Received via mailing list)
I have a controller which iterates through a group of people and
dynamically generates an email for each person, it is a bit DB heavy so
caching would really help.

Adding 'include ActionController::Caching::Fragments' to my
BookingMailer model produces this error:

ActionView::TemplateError (undefined local variable or method
`perform_caching' for #<BookingMailer:0x4768834>)

So I added 'include ActionController::Caching' as well. Now I get:

ActionView::TemplateError (undefined method `url_for' for

I'm using :part => to store each individual booking div as a cache so I
see how a model doesn't know about 'url_for'. Finally I added a third
include 'include ActionController::Base' but my last error is:

TypeError (wrong argument type Class (expected Module)):

Any help would be appreciated, I'm really stuck on this one, my cache
code is this:

<% cache(:controller => 'job', :action => 'open_request_for_jobs',
:part => 'job_' + do -%>
  ... details about the job .....
<% end %>

This topic is locked and can not be replied to.