This project is archived and is in readonly mode.

#2022 ✓resolved

Js.erb templates broken in 2.3.0 RC1?

Reported by zeno | February 19th, 2009 @ 08:40 PM

js.erb templates seem to be broken in 2.3.0 RC1. Is this a known issue?

Controller (controllers/posts_controller.rb)

def create
  respond_to do |format|

View (views/posts/create.js.erb)

alert("the js.erb template is working!");

When I fire the Ajax.Request to /posts I don't get the js alert dialog specified in create.js.erb. I don't get any errors or warnings in the server log. But if I look at the ajax response (with Firebug) I'm basically getting back the whole html layout template...

Comments and changes to this ticket

  • zeno

    zeno February 19th, 2009 @ 08:48 PM

    hmmm, some "evolutions": it seems to work if I specify render :layout => false :

    def create
      respond_to do |format|
        format.js { render :layout => false }
  • josh

    josh February 20th, 2009 @ 02:46 AM

    • Assigned user set to “josh”
    • State changed from “new” to “duplicate”
    • Milestone cleared.

    I believe this issue already came up and was fixed on master. If you could please try again on edge and let me know if your still having any problems.

  • zeno

    zeno February 20th, 2009 @ 08:24 AM

    Joshua, I'd like to try it on edge, but I can't even start mongrel with the latest revision (9702636a08e50e9fed9bf76ad620a6a0a109009e) because of a cookie_store/session error...

    Apparently other users have the same issue (see Thibaud's comment here: #2001 )

  • josh

    josh February 20th, 2009 @ 04:24 PM

    • State changed from “duplicate” to “open”
  • josh

    josh February 20th, 2009 @ 05:05 PM

    Sorry, that issue was just fixed. Please try once again.

  • zeno

    zeno February 21st, 2009 @ 12:16 AM

    Thanks Joshua,

    I could finally test this issue (js.erb templates) with the latest edge revision, and yes, I confirm it has been fixed: js.erb templates are working great out-of-the-box

    thanks z

  • josh

    josh February 21st, 2009 @ 02:53 AM

    • State changed from “open” to “resolved”
  • ben

    ben November 2nd, 2009 @ 06:49 PM

    • Tag changed from 2.3-rc1, javascript, render, template to javascript, render, template
    • Assigned user cleared.

    sorry if it is out of topic,
    but still, found out through those comments how to but,
    working currently with 2.3.4 rails version and jquery,
    had to put the render :layout => false in the format.js
    to make my .js.erb templates working (and took forever to get this page to be noticed... ;) ).

  • Ryan Bigg

    Ryan Bigg October 9th, 2010 @ 09:57 PM

    • Tag cleared.
    • Importance changed from “” to “Low”

    Automatic cleanup of spam.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket