RJS Handler missing

Hi Guys,

I got a missing template error when I tried to achieve a task using RJS.

All I want is to execute an RJS file on ajax call. But I am getting the
following error.

ActionView::MissingTemplate (Missing template line_items/create,
application/create with {:handlers=>[:erb, :builder, :coffee],
:formats=>[:js, :html], :locale=>[:en, :en]}. Searched in:

  • “/app/views”
    ):
    app/controllers/line_items_controller.rb:46:in `create’

But the create.js.rjs is present in the folder /views/line_items. You
can see the handlers miss .rjs extension. I think thats causing the
error.

If I change .rjs to .erb, it works and the content is executed as
javascript and thus I need to modify the RJS functions to Javascript to
return the contents of AJAX call.

Could you please explain how I can attain this using RJS? Please help.

Following is the versions of tools I use.

Ruby version 1.9.2 (i686-linux)
RubyGems version 1.8.10
Rack version 1.3
Rails version 3.1.0
JavaScript Runtime Node.js (V8)
Active Record version 3.1.0
Action Pack version 3.1.0
Active Resource version 3.1.0
Action Mailer version 3.1.0
Active Support version 3.1.0

Thanks in advance.

RJS was stripped out from 3.1.
See http://weblog.rubyonrails.org/2011/4/21/jquery-new-default for
details.

You may also try the following code from the author of RightJS
library:
https://gist.github.com/1200232
It should work with jQuery.

Yup, thats the answer. But I couldn’t make it working with the RightJS
library(the template message error changed to a update_path method
missing error).

Anyway I have fallback to the jQuery method. Thanks for the help.

ad wrote in post #1024807:

RJS was stripped out from 3.1.
See http://weblog.rubyonrails.org/2011/4/21/jquery-new-default for
details.

You may also try the following code from the author of RightJS
library:
https://gist.github.com/1200232
It should work with jQuery.