views:

31

answers:

1

So everything works. But if a user has firebug's console open, they'll see a bug. :D

When my AJAX is sent :

$(".remove_qf").live("click", function(){
  $.ajax({type: "POST", url: $(this).attr("href"), data: { '_method': 'delete' }, dataType: "script"});
  return false;
})

And my controller fires it :

def destroy
  @quick_fact = @organization.quick_facts.find(params[:id])
  @quick_fact.destroy
end

A view is fired and errors out on a 500 :

Missing template quick_facts/destroy.erb in view path app/views:vendor/plugins/rails-ckeditor/app/views

Strange though, because I don't need a destroy view, and I shouldn't add any code to what I have already to tell it to render false. I say this because I have something similar working my project with the same premise.

Anyone know what might be causing this?

Update

Routes.rb

map.resources :organizations,
  :collection => {:live_validation => :post, :search => :get, :send_invitation_code_request => :post} do |organization|
    organization.resources :quick_facts
+1  A: 

I am not an expert in this area, however, I think that 1.) you need to add a handler to your ajax call to determine if the delete was successful & 2.) you may need to add some sort of success status message from the controller's destroy action.

Brian
I think those would be ideal, but not necessary.
Trip
Well, I guess if you don't care whether or not the delete was successful, at a minimum you can add `render :text => ""` to your destroy action (alternatively, `render :nothing => true`). I imagine that may solve the error reported in firebug.
Brian
Strange that my other ones didn't need that one but this controller is being shared in a unique way. But your answer works. Many thanks! :D
Trip