# Respond\_to not detecting RJS

**URL:** <https://www.ruby-forum.com/t/respond-to-not-detecting-rjs/134033>\
**Category:** Rails\
**Created:** [April 7, 2008, 3:43am UTC](https://www.ruby-forum.com/t/respond-to-not-detecting-rjs/134033 "2008-04-07T03:43:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pahagon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pahagon](https://www.ruby-forum.com/u/pahagon)\
**Post date:** [April 7, 2008, 3:43am UTC](https://www.ruby-forum.com/t/respond-to-not-detecting-rjs/134033/1 "2008-04-07T03:43:51Z")

</div>

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

class HomeController \< ApplicationController  
layout ‘layout’

def index  
#some code  
ivr\_info #NOTICE THIS  
end

def ivr\_info  
# some code  
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  
layout ‘layout’

def index  
#some code  
ivr\_info #NOTICE THIS

```
respond_to do |format
  format.html
end

```

end

def ivr\_info  
# some code  
respond\_to do |format  
format.js  
end  
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:** ![pahagon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pahagon](https://www.ruby-forum.com/u/pahagon)\
**Post date:** [April 7, 2008, 11:47am UTC](https://www.ruby-forum.com/t/respond-to-not-detecting-rjs/134033/2 "2008-04-07T11:47:25Z")

</div>

Paulo P. wrote:

> def index  
> #some code  
> ivr\_info #NOTICE THIS
> 
> ```
> respond_to do |format
> format.html
> end
> 
> ```
> 
> end
> 
> def ivr\_info  
> # some code  
> respond\_to do |format  
> format.js  
> end  
> 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

# some code

respond\_to do |format|  
format.js { render :layout =\> false }  
end  
end
