Yield, content_for and Ajax actions?!

Hello,

I have a piece of code like:

... <% content_for :js_templates do -%>   <%= "var phone='#{generate_template(contact_form, :phones, :partial => "/contacts/phones/create")}'" %> <% end -%> ...

But that code is in a view that is called dynamic and of course content_for doesn't work. I would like to know if, someone have a solution for that problem.

Regards, David Sousa