This project is archived and is in readonly mode.
Missing Template errors with rjs
-
Hemant Patel
i have to specify the file to render there which works like
$("#add-notes").after(<%= escape_javascript(render 'form.html.haml') %>);i tried to do this in create.js if i am passing an instance it doesnt work, still get template error
$("#notes").after(<%= escape_javascript(render @note) %>);if i specify file there then it works in the create.js too, but i need to pass instance as local variable there
$("#notes").after(<%= escape_javascript(render 'note.html.haml') %>);Is this the new behavior in rails 3 that we would require to specify file names, i hope i have not missed that
-
Hemant Patel
- Assigned user set to José Valim
-
Repository
(from [56fb60ebfe9a20ced1366f3e35b2f9bd0bac8e45]) Fix rendering of HTML partials inside JS templates [#4197 Missing Template errors with rjs status:resolved] http://github.com/rails/rails/commit/56fb60ebfe9a20ced1366f3e35b2f9...
-
Hemant Patel
Now the partials are rendering fine but if i want to render the new template then again its gives missing tempate errors
$("#notes").after(<%= escape_javascript(render 'new') %>);
This should render the new template but it gives missing tempate errors
ActionView::Template::Error (Missing partial notes/new with {:formats=>[:js, :html], :handlers=>[:rxml, :builder, :rjs, :erb, :haml, :rhtml], :locale=>[:en]}
the render method there just expects to render a partial
-
José Valim
- Milestone cleared.
- State changed from resolved to open
This is odd, it should find the notes/new template. Can you please try to add a failing test case?
-
José Valim
- State changed from open to resolved
Oh, I get it. render("new") is invalid in your view. You should do render(:template => "notes/new").
-
Hemant Patel
hmm.. when i do that the ajax call is doing something weird, the ruby process memory grows infinitely it went up to 6.5GB and my system hanged...
Dont know whats making the memory to grow so much
-
José Valim
Can you try to reproduce this error in Rials test suite or in another application? So you can send me and I can investigate further?
-
Boris
Fixed in
https://github.com/rails/rails/commit/56fb60ebfe9a20ced1366f3e35b2f...And promptly brought back 2 days later
https://github.com/rails/rails/blob/f28d856cece877d1b2f306f54aeb12c...Current problem:
During AJAX, you cannot render an HTML partial from within a JS partial:_new_object.js.erb
<%= render(@object)) %>
Fails, will only look for JS.erb not HTML.erb
Boris