After filter not working

I have a simple “after_filter” that is supposed to remove “child”
records from one table (folders_tbl) when the parent is deleted from
another table (courses_tbl). It’s not working. The “course” gets
destroyed but the children “folders” do not. Filters aren’t that
complicated but I don’t understand why this isn’t working. I’ve
included snipplets below. Any ideas?

–course controller–
after_filter :courseCleanUp, :only => :delete

DELETE /courses/1

def destroy
@course = Course.find(params[:id])
@course.destroy
respond_to do |format|
format.html { redirect_to :action => :index }
end
end

protected

def courseCleanUp
Folder.destroy_all([“course_id = ?”, session[:course_id]])
end

On 3 Jun 2008, at 16:39, Corey M. wrote:

the :only needs to be the action_name (ie :destroy). I’d also
recommend that the controller know absolutely nothing about this (use
callbacks, :dependent => :destroy etc…)

Fred

Frederick C. wrote:

On 3 Jun 2008, at 16:39, Corey M. wrote:

the :only needs to be the action_name (ie :destroy). I’d also
recommend that the controller know absolutely nothing about this (use
callbacks, :dependent => :destroy etc…)

Fred

Thanks for the ideas. I’ve gone to using the “after_destroy” call back
in the model and it worked great.

Thanks again