How can I generate a random hex color with ruby?
SecureRandom.hex(3) #=> "fef912"
The SecureRandom module is part of Ruby's standard library
SecureRandom
require 'securerandom'
It's autoloaded in Rails, but if you're using Rails 3.0 or lower, you'll need to use
ActiveSupport::SecureRandom.hex(3)