Thanks, Fred! This works as expected now. I've made a config/initializers/modules.rb. For now I only require this one module, but I'll probably just have this require everything in lib/modules so that I don't have to worry about the next one.
On May 28, 4:13 am, Frederick Cheung <[email protected]> wrote: > On May 28, 5:06 am, Brian <[email protected]> wrote: > > > So it seems reasonable to me that this might happen if my_model.rb is > > loaded first, then my module, then the test. Additional evidence is > > that if I add a "debugger" line to my included callback, I'm never > > sent to the debugger. Unless I remove the call to my_method, then I > > am. > > > So if my hypothesis is correct, it's a bad idea to add my modules to > > lib\modules and append that to the end of my load path. But then > > where should I stash modules that update rails classes? > > The problem is not so much where you put it but when it's loaded. If > you just stick a file in lib/blah rails isn't going to magically trip > over it. It will load your module if elsewhere you say MyModule, and > in production mode it will load it at some point. So you need to > require it explicitly and you need to do so at the right point, and > that happens to be from an initializer (ie a file in config/ > initializers) - these are run after rails has been loaded, but before > your application classes are. > > Fred --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

