Secure Random passwords in Ruby

Problem
You would like to use a random password in ruby. Most solutions describe using the Digest library (Digest::SHA1).

Solution
According to the post here, you can achieve the same by using ActiveSupport’s secure_random library.
To use it in Ruby outside Rails use:


and inside rails: