Scott Kulik wrote:> is there a way i can get a rake task to destroy the dependents declared
> in the model when an item is destroyed?
> 
> here is my rake task code:
> 
> task(:deleteFakes => :environment) do
>    @items = Item.find(:all, :conditions => ''items.fake =
true'', :order
> => ''name'')
> 
>    @items.each do |item|
>      item.destroy
>      puts item.name + " destroyed!"
>    end
> end
> 
> and part of the item model:
> 
>   has_many :compounds, :dependent => :destroy
> 
> if i delete the items through the web interface the item and it''s
> associated compounds are removed.  is there a way i can get this to work
> from the rake task?
> 
> thanks.
> scott
sorry, i figured it out.  it actually is working as expected, i had some 
relations to the item that were not directly linked to the dependent 
clause.
-- 
Posted via http://www.ruby-forum.com/.