render :update on destroy
Posted by
goSU
on
January 12, 2012
Hi! Im using rails 2.3.11 and Im struggling to make a destroy method to update te current view via ajax..
To make it clear here is al example: Im at, lets say
# localhost:3000/user/512/edit
here I have a list of items in a table, and in the last column I have some links like show, edit, and delete, and at the top I have an add link show,add and edit links, pops up in a colorbox (jquery), the edit and the add uses a remot_form_for and they send data via ajax, inside the create ,the update and the destroy method, on my item_controller i have a block of render :update like
# render :update do |page|
# page.replace_html "items", :file => "items/index"
# page << "makeColorBox()"
# end
when I create or update an item works just fine, updates the content, but when I destroy an item, execute that render :update block (I put a logger inside to know that), but in the end it "reditects" me to
# localhost:3000/items/id_of_destroyed_item
and shows me and error like
# localhost:3000/user/512/edit
# localhost:3000/user/512/edit
try { $("#items").html( bla bla bla) catch (e) { alert('RJS error:\n\n' + e.toString()); bla bla bla}

Login to leave a comment