Observer don't check if condition

i have a problem with the mail deliver after a entry is save.
I want to check if one field is filled. In every Option (Controller
action, model, observer) i wrote a

if !entry.field.nil?

But i get this mail also if the entry field is nil.

I also wrote a EntryObserver which implements the following method

def after_save(entry)
Mail.deliver_entry(entry) if !entry.field.nil?

can anybody tell me, why this doesn't work for me?

thanks alex

I suspect what is happening is that entry.field is the empty string (which is of course not nil). .blank? checks for both nil and the empty string



try using 'entry.field.blank?' instead of 'entry.field.nil?'.

Falk Köppe

i tested both things but nothing works.

DAMN it. it works, mistake by me !! Thanks for all your help