# Yield, content\_for and Ajax actions?!

**URL:** <https://www.ruby-forum.com/t/yield-content-for-and-ajax-actions/172251>\
**Category:** Rails\
**Created:** [July 17, 2009, 3:54pm UTC](https://www.ruby-forum.com/t/yield-content-for-and-ajax-actions/172251 "2009-07-17T15:54:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 17, 2009, 3:54pm UTC](https://www.ruby-forum.com/t/yield-content-for-and-ajax-actions/172251/1 "2009-07-17T15:54:26Z")

</div>

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 S.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [July 20, 2009, 6:30am UTC](https://www.ruby-forum.com/t/yield-content-for-and-ajax-actions/172251/2 "2009-07-20T06:30:10Z")

</div>

Someone? (UP)
