This project is archived and is in readonly mode.
UJS fail to render partial
Reported by Trung Lê | March 2nd, 2010 @ 12:13 PM | in 3.0.2
I upgraded to latest v3.0.1 beta (GitHub) today and my jQuery code no longer works. I got a script like this in add_to_cart.js.erb
$("#cart").html("<%= escape_javascript(render :partial => "cart", :object => @cart) %>");
I got following error:
ActionView::Template::Error (Missing partial store/cart with {:formats=>[:js]} in view paths "/home/mojo/Sites/depot/app/views") ...
even though my _cart.html.erb is present.
Comments and changes to this ticket
-
Harry Brundage March 2nd, 2010 @ 09:14 PM
... store/cart with {:formats=>[:js]} in view ...
_cart.html.erb
Rails is looking for _cart.erb or _cart.js.erb, since is a JS format request it won't use the HTML format helper I think. Try renaming _cart.html.erb to _cart.erb, or creating another version specifically for your JS requests in _cart.js.erb.
-
Trung Lê March 2nd, 2010 @ 10:38 PM
renaming it to _cart.erb works. But still this behaviour is very strange. Is it just introduced in latest Rails changes?
-
José Valim March 3rd, 2010 @ 08:40 AM
- Assigned user set to Yehuda Katz (wycats)
- Milestone cleared.
-
Erik St. Martin April 16th, 2010 @ 01:36 AM
- Assigned user changed from Yehuda Katz (wycats) to Ryan Bigg
This is expected behavior as rails wants to render the correct partial based on the current format.
please mark as invalid.
-
Ryan Bigg April 16th, 2010 @ 01:38 AM
- State changed from new to invalid
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>