Forum: Ruby on Rails Something strange about RJS, please help.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
6f3f4fcb842db4b755cd8adc8bca67c6?d=identicon&s=25 ms (Guest)
on 2008-11-11 15:34
(Received via mailing list)

thanks for reading this. :) I've got some problems with RJS in
separate files. What's the correct extension? When I name it *.rjs /
*.js.rjs, Ruby on Rails complains that it in not able to find a
*.js.erb template. But when I name it *.js.erb, nothing is translated
to javascript, only the raw text is given back to the client. When I
try inline RJS directly in my controllers with "render :update ...",
it runs perfectly. What am I doing wrong?

Really thank you for any answers.
2d8132658d56e51f19ace1c68e48b6aa?d=identicon&s=25 Thorsten Mueller (thorsten)
on 2008-11-11 15:53
(Received via mailing list)
The right naming is *.js.rjs

At the end of the controller you need:

respond_to do |format|

to make that work
49de4cd2f26705785cbef2b15a9df7aa?d=identicon&s=25 Nick (Guest)
on 2008-11-11 16:56
(Received via mailing list)
On Nov 11, 9:49 am, Thorsten Müller <> wrote:
> The right naming is *.js.rjs
> At the end of the controller you need:
> respond_to do |format|
>    format.js
> end
> to make that work

Keep this bug report in mind if you're calling #render_to_string
before the default view is rendered:

The solution is to rename the default view to filename.rjs (as opposed
to filename.js.rjs).

This topic is locked and can not be replied to.