Last Updated: February 25, 2016
· javier_toledo
Seriousmeh square

Fast solution for 'uninitialized constant ActiveSupport::SecureRandom'

If you're having this exception after updating a Rails application to version >=3.2.X, on Ruby >1.9.X..

uninitialized constant ActiveSupport::SecureRandom

..and you don't want to debug half dozen gems until you
find which one is causing the error, you can use this hack
as Ruby's >1.9 SecureRandom API is 100% compatible with the
Rails <3.2 ActiveSupport::SecureRandom API.

Just add this line in some initializer:

ActiveSupport::SecureRandom = SecureRandom

This is absolute uglyness, but it works and I won't tell nobody
that you went so lazy to use it ;-)

Say Thanks
Awesome Job

16280de8 7c1b 11e7 8768 5c1fc377b8ec
Python Developer
Papendrecht, the Netherlands
Full Time