Ruby-on-rails – Rails :dependent and :delete

activerecorddependenciesruby-on-rails

I am running Rails 2.0.2 and am unable to use :dependent => :delete in my AR associations

 has_many :items, :dependent => :delete

I am given this error.

  The :dependent option expects either :destroy, :delete_all, or :nullify (:delete)

I have be unable to find the documentation for :delete_all to see if it does what I want. Is it basically the same thing as delete? Was :delete recently added to Rails and is not in the version I am using?

Best Solution

Here's the relevant documentation for Rails 2.0.2:

if set to :destroy all the associated objects are destroyed alongside this object by calling their destroy method. If set to :delete_all all associated objects are deleted without calling their destroy method. If set to :nullify all associated objects’ foreign keys are set to NULL without calling their save callbacks.

railsbrain.com is a good place to find docs specific to a certain version of Rails.