# respond\_to not detecting RJS

**URL:** <https://discuss.rubyonrails.org/t/respond-to-not-detecting-rjs/27630>\
**Category:** rubyonrails-talk\
**Created:** [April 7, 2008, 1:43am UTC](https://discuss.rubyonrails.org/t/respond-to-not-detecting-rjs/27630 "2008-04-07T01:43:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Pereira](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@Paulo\_Pereira](https://discuss.rubyonrails.org/u/Paulo_Pereira)\
**Post date:** [April 7, 2008, 1:43am UTC](https://discuss.rubyonrails.org/t/respond-to-not-detecting-rjs/27630/1 "2008-04-07T01:43:06Z")

</div>

Hi there. First of all, I'm not using REST.

class HomeController \< ApplicationController &nbsp;&nbsp;layout 'layout'

&nbsp;&nbsp;def index &nbsp;&nbsp;&nbsp;&nbsp;#some code &nbsp;&nbsp;&nbsp;&nbsp;ivr\_info #NOTICE THIS &nbsp;&nbsp;end

&nbsp;&nbsp;def ivr\_info &nbsp;&nbsp;&nbsp;&nbsp;# some code &nbsp;&nbsp;end end

This is views/home: \_ivr\_info.html.erb index.html.erb ivr\_info.js.rjs

I'm making an AJAX request to /home/ivr\_info \<%= link\_to\_remote "Update", :url =\> {:controller =\> 'home', :action =\> 'ivr\_info'} %\>

And the RJS is, well, ignored. I tried this:

class HomeController \< ApplicationController &nbsp;&nbsp;layout 'layout'

&nbsp;&nbsp;def index &nbsp;&nbsp;&nbsp;&nbsp;#some code &nbsp;&nbsp;&nbsp;&nbsp;ivr\_info #NOTICE THIS

&nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.html &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end

&nbsp;&nbsp;def ivr\_info &nbsp;&nbsp;&nbsp;&nbsp;# some code &nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.js &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end end

Well, i've got this errror:

Template is missing Missing layout layouts/layout.js.erb in view path D:/netbeans/rhymon/ app/views

Even with layout 'layout', :only =\> 'index' , i've got the same error. With is this happening? I've been recently introduced to respond\_to (with REST, but i'm not using REST in this application), and google wasn't any help for me.

---

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [April 7, 2008, 9:47am UTC](https://discuss.rubyonrails.org/t/respond-to-not-detecting-rjs/27630/2 "2008-04-07T09:47:25Z")

</div>

Paulo Pereira wrote:

> &nbsp;&nbsp;def index &nbsp;&nbsp;&nbsp;&nbsp;#some code &nbsp;&nbsp;&nbsp;&nbsp;ivr\_info #NOTICE THIS
> 
> &nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.html &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end
> 
> &nbsp;&nbsp;def ivr\_info &nbsp;&nbsp;&nbsp;&nbsp;# some code &nbsp;&nbsp;&nbsp;&nbsp;respond\_to do |format &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;format.js &nbsp;&nbsp;&nbsp;&nbsp;end &nbsp;&nbsp;end end

It's not a good idea to call from one action to another unless you are definitely not going to be rendering in one of them. Put the common code in a separate private method and call it from each action. Then, try:

def ivr\_info &nbsp;&nbsp;# some code &nbsp;&nbsp;respond\_to do |format| &nbsp;&nbsp;&nbsp;&nbsp;format.js { render :layout =\> false } &nbsp;&nbsp;end end
