Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why I received the error "uninitialized constant SecureRandom?

Tags:

ruby

I am using Ruby 1.9.3 and using the following

puts SecureRandom.uuid

but I received the error

uninitialized constant SecureRandom

How to fix this issue?

like image 779
Adam Lee Avatar asked Mar 16 '15 10:03

Adam Lee


2 Answers

You need to add a require statement in the beginning of the file:

require 'securerandom'
like image 106
Paweł Dawczak Avatar answered Oct 26 '22 02:10

Paweł Dawczak


You need to require ruby library of securerandom to run this method

require 'securerandom'
like image 32
user3118220 Avatar answered Oct 26 '22 01:10

user3118220



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!