Fragment Cache in ActionMailer


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 %>