Respond_to not detecting RJS

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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs