# Attachment\_fu :partition =\> lamda {}

**URL:** <https://www.ruby-forum.com/t/attachment-fu-partition-lamda/172236>\
**Category:** Rails\
**Created:** [July 17, 2009, 7:21am UTC](https://www.ruby-forum.com/t/attachment-fu-partition-lamda/172236 "2009-07-17T07:21:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![northband](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@northband](https://www.ruby-forum.com/u/northband)\
**Post date:** [July 17, 2009, 7:21am UTC](https://www.ruby-forum.com/t/attachment-fu-partition-lamda/172236/1 "2009-07-17T07:21:10Z")

</div>

Hi -

I am trying to dynamically create my partition folders via  
attachment\_fu. I have read about a hack that allows you to do this on  
the attachment model:

:partition =\> lambda {|a| a.article\_id}

Which passes the model’s object into the lambda and uses the  
‘article\_id’ attribute as its directory name. However, this isn’t  
work for me. I think the lambda is simply evaluating as ‘true’ and  
causing attachment\_fu to simply do conventional directory creation on  
my file system.

Anyone find a way to get this to work - or have a way to dynamically  
create partitions from object attributes like ‘a.name’ etc…?

Any help appreciated!

---

<div class="post-metadata">

**Author:** ![northband](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ecae2f/32.png) [@northband](https://www.ruby-forum.com/u/northband)\
**Post date:** [July 17, 2009, 7:42am UTC](https://www.ruby-forum.com/t/attachment-fu-partition-lamda/172236/2 "2009-07-17T07:42:47Z")

</div>

NVM - silly me forgot to grab the forked attachment\_fu. Works fine now.
