Validating to see if item can be destroyed

Hey all. I think I flooded #rubyonrails too much I'm not getting
replies anymore.. hehe.

Let's say I have two models: Idea and IdeaImage. Idea has_many
:idea_images and IdeaImage belongs_to :idea. Here's my question: how
do I allow deletion _only if_ there is more than 1 idea_image left in
idea?

Here are the different scenarios I've tried:

http://pastie.caboo.se/151482

I'm stumped :o

Thanks,

Ok, super weird... I put a debugger:

  def validate_as_destroyable
    debugger
    if idea.idea_images.size <= 1
      return false
    end
  end

in the debugger i type idea. it works. i type idea.idea_images. it
works. in my log i still get the same error though...

NoMethodError (You have a nil object when you didn't expect it!
The error occurred while evaluating nil.idea_images):
    /app/models/idea_image.rb:25:in `validate_as_destroyable'

I've fallen into this trap SO MANY times before...

It was failing because I was using attachment_fu and the thumbnails'
idea_id were nil. Ugh.. sorry for wasting your time (and mine, haha!)