Attachment_fu - propagating attributes to thumbnails


#1

I have a model using attachment_fu (via has_attachment) and I’m
creating thumbnails for the attached images. I have an extra field
‘foo’ that I’m validating on create with validates_presence_of :foo.

One problem arises when I upload an image:

The ‘foo’ is not propogating down to the thumbnails. What should I
put in my model to grab the parent’s (via parent_id) ‘foo’ if no foo
is provided?

Thanks in advance.


#2

I’m not sure if this is what you’re looking for, but I had a similar
problem giving a thumbnail
the foreign key of its parent. Try this in the model that’s using
attachment_fu:

before_thumbnail_saved do |record, thumbnail|
thumbnail.foo = record.foo
end