Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

object id more than 8 digits #1

Open
yebihara opened this issue Aug 4, 2010 · 1 comment
Open

object id more than 8 digits #1

yebihara opened this issue Aug 4, 2010 · 1 comment

Comments

@yebihara
Copy link

yebihara commented Aug 4, 2010

Hi,

I found the lines as below in file_column.rb:

def relative_path_prefix
  raise RuntimeError.new("Trying to access file_column, but primary key got lost.") if @instance.id.to_s.empty?
  File.join(*("%08d" % @instance.id).scan(/..../))
end

The id of my object with file_column gets more than 8 digits and the directory paths sometimes conflict because of this.

irb(main):023:0> ("%08d" % 12345678).scan(/..../)
=> ["1234", "5678"]
irb(main):024:0> ("%08d" % 123456789).scan(/..../)
=> ["1234", "5678"]
irb(main):025:0> ("%08d" % 1234567890).scan(/..../)
=> ["1234", "5678"]
irb(main):026:0> ("%08d" % 12345678901).scan(/..../)
=> ["1234", "5678"]
irb(main):027:0> ("%08d" % 123456789012).scan(/..../)
=> ["1234", "5678", "9012"]

Could you resolve this issue?

Thanks,

ebi

@borovsky
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants