In development mode rails reloads all the controllers and models each time they are requested. Is it possible to make rails reload any other files, for example ones that I placed under the lib folder and require in environment.rb? -- *Jeremy Wells* Serval Systems Ltd. www.servalsystems.co.uk <http://www.servalsystems.co.uk> Tel: 01342 331940 Fax: 01342 331950 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > In development mode rails reloads all the controllers and models each > time they are requested. Is it possible to make rails reload any other > files, for example ones that I placed under the lib folder and require > in environment.rb?If anybody has a solution to this I too would be interested in knowing. Is the reload list configurable in any way at all? If not where is the list so I can change it manually? --~--~---------~--~----~------------~-------~--~----~ 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 12/18/06, Tim Uckun <timuckun-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > > In development mode rails reloads all the controllers and models each > > time they are requested. Is it possible to make rails reload any other > > files, for example ones that I placed under the lib folder and require > > in environment.rb? > > If anybody has a solution to this I too would be interested in > knowing. Is the reload list configurable in any way at all?You need to include Reloadable in the classes you want reloaded. class Fred include Reloadable end This will make Fred and all its subclasses reload on each request. There''s also include Reloadable::Subclasses. class Base include Reloadable::Subclasses end This makes subclasses of Base reload on each request, but not Base itself. (Used, for instance, by ActiveRecord::Base.) You can also *prevent* a class from being reloaded by making #reloadable? return false. class MyThingy < Base def self.reloadable? false end end HTH. --~--~---------~--~----~------------~-------~--~----~ 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 6, 7:59 am, Jeremy Wells <jwe...-cH1Rxhrj+4a/3pe1ocb+s/XRex20P6io@public.gmane.org> wrote:> In development mode rails reloads all the controllers and models each > time they are requested. Is it possible to make rails reload any other > files, for example ones that I placed under the lib folder and require > in environment.rb?In Rails 1.1.6 you can put "include Reloadable" into your lib classes to make them reload (only works for classes, not modules). In Rails 1.2 "include Reloadable" has been deprecated. My understanding is that class reloading has been improved making the explicit Reloadable declaration unnecessary. Aaron --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---