# Linking to RJS files from multiple locations

**URL:** <https://www.ruby-forum.com/t/linking-to-rjs-files-from-multiple-locations/167032>\
**Category:** Rails\
**Created:** [May 2, 2009, 2:42pm UTC](https://www.ruby-forum.com/t/linking-to-rjs-files-from-multiple-locations/167032 "2009-05-02T14:42:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [May 2, 2009, 2:42pm UTC](https://www.ruby-forum.com/t/linking-to-rjs-files-from-multiple-locations/167032/1 "2009-05-02T14:42:51Z")

</div>

Hi,  
I have a simple RJS file which adds some text to a div like so…

VIEW

\<%= button\_to\_remote “Test”, :url =\> {:action =\> ‘test’} %\>

RJS

page.insert\_html :bottom, “testdiv”, “test value”

This works fine, however I’d like to place the RJS file in a different  
directory and use it with multiple controllers.

\<%= button\_to\_remote “Test”, :url =\> {:controller =\> ‘testcontroller’,  
:action =\> ‘test’} %\>

The RJS file is the same, just moved to the ‘testcontroller’ view  
directory. This dosen’t seem to be working, can anyone advise me as to  
what’s going wrong?  
Thanks.

---

<div class="post-metadata">

**Author:** ![drsharp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/e9bcb4/32.png) [@drsharp](https://www.ruby-forum.com/u/drsharp)\
**Post date:** [May 2, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/linking-to-rjs-files-from-multiple-locations/167032/2 "2009-05-02T17:10:50Z")

</div>

> \<%= button\_to\_remote “Test”, :url =\> {:controller =\> ‘testcontroller’,  
> :action =\> ‘test’} %\>
> 
> The RJS file is the same, just moved to the ‘testcontroller’ view  
> directory. This dosen’t seem to be working, can anyone advise me as to  
> what’s going wrong?

Is the request even reaching the testcontroller?
