Skip to content

Instantly share code, notes, and snippets.

@mmcc
Created June 26, 2012 17:25
Show Gist options
  • Save mmcc/2997231 to your computer and use it in GitHub Desktop.
Save mmcc/2997231 to your computer and use it in GitHub Desktop.
destroy.js.erb not hiding
# Controller
respond_to :html, :js
# DELETE /users/1
def destroy
@student = User.find(params[:id])
@student.destroy
respond_with(@student)
rescue
puts $!.inspect, $@
render :nothing => true
end
# destroy.js.erb
console.log("Test if this is actually firing"); // Not logging to the console.
$('#<%= dom_id(@student) %>').hide(); // Hide the deleted record.
# View.haml
= link_to student_path(s), :class => "btn btn-mini btn-danger", :method => "delete", :confirm => "Are you sure you want to delete this student?", :remote => "true", :title => "Delete Student" do
%i.icon-remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment