Skip to content

Instantly share code, notes, and snippets.

@billy3321
Created October 26, 2015 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billy3321/91452084a345e415214a to your computer and use it in GitHub Desktop.
Save billy3321/91452084a345e415214a to your computer and use it in GitHub Desktop.
def set_avatar
if avatar.blank?
if gender == 'male'
avatar = File.open(Dir['male/*'].sample)
elsif gender == 'female'
avatar = File.open(Dir['female/*'].sample)
else
avatar = File.open(Dir['male/*', 'female/*'].sample)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment