relationships and delete

You need to tell the relationship that the photo's are dependent on the
car. So...

has_many :photos, :dependent => :destroy

Now, when you destroy the car, all it's photos go with it. See the API
for more info...

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M000530

pablo wrote: