Skip to content

The assets paths using wildcard are not consistent on ruby 1.9 #2003

acroca opened this Issue Jul 7, 2011 · 0 comments

1 participant

acroca commented Jul 7, 2011

When using wildcard %d in assets path is suposed to have a random-like number between [0-3].
It works using String.hash instance method, but in ruby 1.9 this method is not returning always the same hash for the same string.
Just run "hi".hash twice in two different irb consoles. (In the same it works, I read that have some random seed...)

So in production, every server instance have a different asset number. Or with one server, every restart has a different number too.

The asset is still available but in the browser side is better to have the same asset ID because the browser can cache the asset just once and not 4 times.

I've changed this to use a String.bytes.sum instead of String.hash

@acroca acroca closed this Jul 7, 2011
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.