Setting default on "has_one" failure

Hi there,
I have a model for a Film, which:

has_and_belongs_to_many :artists
has_many :stills
has_one :preview_image,
:class_name => “Still”,
:conditions => “priority=‘main’”

the has_one:preview_image and has_many:stills obviously draw from the
same table.

I was wondering if there is a way to set a default value for
:preview_image (say :stills[0] for example) if has_one fails to retrieve
a :preview_image from the db?

If it’s easier to send me link, then I’d happily read a page about what
you can do to models, as I’m finding it difficult to do very much in the
model pages.

thanks

dorian


I do things for love or money

+44 (0)7941 219 501

aim:oulalipo | yahoo:tachekent