Using functionality in /lib in initializers

I need to use some functionality that I've added to the Hash class in an initializer. I've written the functionality into /lib/hash.rb; however, rails apparently loads the files in /lib after the initializers as the methods are not there to use in the initializer.

I've used a require statement at the top of the initializer to get the functionality...    require File.join(RAILS_ROOT, 'lib', 'hash')

It works and no warnings are being thrown in the log; however, since rails doesn't load them until after the initializers, I wanted to ask... Is this unsafe in some way?

-- TW

I need to use some functionality that I've added to the Hash class in an initializer. I've written the functionality into /lib/hash.rb; however, rails apparently loads the files in /lib after the initializers as the methods are not there to use in the initializer.

Except perhaps in production mode, rails won't magically load files from lib for you (and event then that loading happens before initializers run)

I've used a require statement at the top of the initializer to get the functionality... require File.join(RAILS_ROOT, 'lib', 'hash')

Just require 'hash' would do

Fred

Ahh, I see! Thanks Fred!

-- TW