Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

id_partition doesn't work with mongodb #757

Closed
ikonyshev opened this Issue · 1 comment

2 participants

@ikonyshev

according to code below (it's from interpolations.rb) id_partition function return nil for mongo ids because mongo use own id class. I think it would be great to convert id to string using .to_s to avoid such problems.
Also it seems that taking only first 3 matches for string ids can cause problems (for example my project is going to have 200-300k items with up to 30 images per item, and these 3 matches wouldn't help at all)

    def id_partition attachment, style_name
      case id = attachment.instance.id
      when Integer
        ("%09d" % id).scan(/\d{3}/).join("/")
      when String
        id.scan(/.{3}/).first(3).join("/")
      else
        nil
      end
    end
@sikachu
Admin

Yeah, I think for mongo you'll have to write the id_partition interpolation yourself, and override the one given by paperclip.

@sikachu sikachu closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.