I’m using Paperclip to handle avatar’s for users and currently set a default image using:
:default_url => '/images/img-missing_:style.png'
But what I’d like to do is when a user registers, give them a random avatar that they get until they upload their own.
Twitter does this with its “egg” avatar and that have probably half a dozen different colors that get assigned.
How can I accomplish this?
Note, I’m not wanting to show a random avatar every time a call to the user is made, rather I want them to be assigned a random avatar when they register and have that one stick with them until they upload their own.
Lets say you have 10 default avatars, you could use the modulus of their user ID to determine which one is displayed. This would be consistent and trivial to implement.