Forum: Ruby on Rails Re: attachment_fu File System Storage Change - Update?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
unknown (Guest)
on 2007-04-10 03:10
(Received via mailing list)
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
Walter McGinnis (Guest)
on 2007-06-18 07:33
(Received via mailing list)
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
This topic is locked and can not be replied to.