# Attachment\_fu - propagating attributes to thumbnails

**URL:** <https://www.ruby-forum.com/t/attachment-fu-propagating-attributes-to-thumbnails/92299>\
**Category:** Rails\
**Created:** [April 18, 2007, 12:39am UTC](https://www.ruby-forum.com/t/attachment-fu-propagating-attributes-to-thumbnails/92299 "2007-04-18T00:39:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jstepper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@jstepper](https://www.ruby-forum.com/u/jstepper)\
**Post date:** [April 18, 2007, 12:39am UTC](https://www.ruby-forum.com/t/attachment-fu-propagating-attributes-to-thumbnails/92299/1 "2007-04-18T00:39:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jstepper](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@jstepper](https://www.ruby-forum.com/u/jstepper)\
**Post date:** [April 28, 2007, 3:57pm UTC](https://www.ruby-forum.com/t/attachment-fu-propagating-attributes-to-thumbnails/92299/2 "2007-04-28T15:57:23Z")

</div>

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
