On Mar 19, 10:08 pm, tekwiz <[email protected]> wrote:
> 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
>
> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---