I have a module called Retain. That module has pieces in app/controller/retain, app/model/retain, and lib/retain. If I have to, I can rename them but, for now, that is what I have. In lib/retain I have a file called exceptions where I define my exceptions like: module Retain class RetainEerror < StandardError end class FooError < RetainError end ... end I have an explicit "require ''retian/exception''" in one of my controllers. The very first run through the code, it finds FooError, etc. The next time (like if I hit refresh), it does not. FooError becomes undefined. This is in development mode and I have class caching turned off: config.cache_classes = false Is the fact that I have the Retain module scattered all over the problem? If not, can anyone suggest what the problem might be? Thank you, pedz -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 29, 2007 2:00 PM, Perry Smith <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> This is in development mode and I have class caching turned off: > config.cache_classes = false> Is the fact that I have the Retain module scattered all over the > problem? If not, can anyone suggest what the problem might be?Probably not the problem with scattering the file all over the place. More likely to do with Rails'' dynamic reloading of the files on each refresh in development mode. What happens if you turn on class caching or run in production mode? If this works, you might want to move the require ''foo'' into the application_controller as a more central require location or even better, put it in as an initializer file in config/initializers if you are on Rails 2.0 or in an environment.rb file if you are not. Regards Mikel --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I turned on the class caching and that solved the problem. I then turned it back off and rearranged the require and put the require in config/initializers and that is working too. Thanks for your help, pedz -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---