# Re: attachment\_fu File System Storage Change - Update?

**URL:** <https://www.ruby-forum.com/t/re-attachment-fu-file-system-storage-change-update/91512>\
**Category:** Rails\
**Created:** [April 10, 2007, 1:10am UTC](https://www.ruby-forum.com/t/re-attachment-fu-file-system-storage-change-update/91512 "2007-04-10T01:10:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [April 10, 2007, 1:10am UTC](https://www.ruby-forum.com/t/re-attachment-fu-file-system-storage-change-update/91512/1 "2007-04-10T01:10:08Z")

</div>

Rick,

Thanks a ton for this. I just realized this response was sitting in my  
spam folder and I’ve since re-sent the question to the list so please  
ignore those. Whoops.

This looks good - I will give it a go.

Thanks again for this and the great plug-in!

Hunter

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [June 18, 2007, 5:33am UTC](https://www.ruby-forum.com/t/re-attachment-fu-file-system-storage-change-update/91512/2 "2007-06-18T05:33:51Z")

</div>

Unfortunately I had a lot of links pointing back at legacy paths.  
Here’s my middleground solution that I think allows me to move forward  
with the new scheme for paths while not having to move my old files:

# workaround for legacy attachments

```
                                                          def

```

partitioned\_path(\*args)  
if LEGACY\_IMAGE\_FILE\_PATHS\_UP\_TO.nil? or attachment\_path\_id.to\_i \>  
LEGACY\_IMAGE\_FILE\_PATHS\_UP\_TO.to\_i  
("%08d" % attachment\_path\_id).scan(/…/) + args  
else  
[attachment\_path\_id.to\_s] + args  
end  
end

I’ve got about 10k existing image files with ids up to about 49081,  
since the new scheme starts creating directories at 0000, I doubt I’ll  
see any directory names that will collide. I must admit to being lazy  
in the math department. Am I missing anything?

Cheers,  
Walter
