RE: [Rails] Re: attachment_fu File System Storage Change - Update?


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!


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