My heroku app is crashing because it can't find the module 'SecureRandom'. I am specifying my Ruby version in the gemfile, and my computer, gemfile and Heroku all seem to match Ruby version numbers, though not the patch numbers.
Other posts have suggested pointing usr/bin/heroku to a specific Ruby file, but I'm not sure how to do that (I have no Heroku bin in my app). This does seem like a Ruby version error. How can I try to fix this?
class OrderItem < ActiveRecord::Base
require 'SecureRandom'
...
end
Heroku log:
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': No such file to load -- SecureRandom (LoadError)
Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
Command line:
/ $ heroku run ruby -v
Running `ruby -v` attached to terminal... up, run.9318
ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]
/ $ ruby -v
ruby 2.0.0p451 (2014-02-24 revision 45167) [x86_64-darwin12.5.0]
Thanks in advance.
The actual name is securerandom
, all lowercase. Linux filesystems are usually case sensitive.
So, change your require to:
require 'securerandom'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With