I installed hashids gem as instructed here: https://github.com/peterhellberg/hashids.rb
However, when I try to use the Hashids class it shows me an error as if it doesn't know this class:
NameError at / uninitialized constant Hashids
This is the code where it fails:
tocode = Hashids.new("test")
I am not even sure how to debug this as I am new to ruby. I know that the class is defined in the Hashids library. I don't think I am supposed to use 'required' as I installed this as a gem. When I run 'gem list' I see that gem there:
hashids (1.0.3)
After you installed the
Hashids
gem, it will not add to your$LOAD_PATH
by default, when your sayHashids.new("test")
ruby will try to findHashids
in your$LOAD_PATH
, it will raiseNameError at / uninitialized constant Hashids
once it can't be found. To appendHashids
to your$LOAD_PATH
, your needbefore you use it.