# Javascript\_include\_tag and controller actions

**URL:** <https://www.ruby-forum.com/t/javascript-include-tag-and-controller-actions/127862>\
**Category:** Rails\
**Created:** [February 1, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/javascript-include-tag-and-controller-actions/127862 "2008-02-01T22:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Pelley](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/9de0a6/32.png) [@Mike\_Pelley](https://www.ruby-forum.com/u/Mike_Pelley)\
**Post date:** [February 1, 2008, 10:00pm UTC](https://www.ruby-forum.com/t/javascript-include-tag-and-controller-actions/127862/1 "2008-02-01T22:00:00Z")

</div>

Hello folks,

I’d like to include the javascript generated by an RJS file in an  
RHTML file using the tags. I was going to use  
javascript\_include\_tag to do this, mostly in order to ensure that the  
contents are not cached by the browser.

Unfortunately, javascript\_include\_tag appends a “.js” to the file name  
if there is not a period in the file name. This means that I cannot  
do

\<%= javascript\_include\_tag ‘/browse/read\_variables’ %\>

when read\_variables is an action in the browse controller with an RJS  
template.

There are various ways to work around this behaviour, but it seems  
like a reasonable approach that should work. Is there a way to use  
javascript\_include\_tag with an action? If not, is it something that  
should be corrected in Rails, or is my usage too obscure/wrong/  
whatever?

Thanks,  
Mike.
