I spent many hour yesterday working to resolve a problem where the tests where green and the real-world would fail. Eventually I ended up restarting WeBrick and things got better. Unfortunately, I have little memory of what code I really changed that fixed the problem, so what code might not reload automaticaly in DEV mode? David
David Corbin wrote:>I spent many hour yesterday working to resolve a problem where the tests where >green and the real-world would fail. Eventually I ended up restarting >WeBrick and things got better. Unfortunately, I have little memory of what >code I really changed that fixed the problem, so what code might not reload >automaticaly in DEV mode? > >Any code - you use require to load (use require_dependency) - that is loaded by your environment.rb or (development|production).rb files - that you loaded during on request, and then removed the line which loaded the file In addition, some changes are not handled too well. For example, if you remove a method from a class, the old implementation of that method may hang around until you restart the server. (I''m not entirely certain if this is still the case.) POPULATION EXPLOSION Unique in human experience, an event which happened yesterday but which everyone swears won''t happen until tomorrow. - The Hipcrime Vocab by Chad C. Mulligan
On Monday 06 June 2005 10:33 pm, Nicholas Seckar wrote:> David Corbin wrote: > >I spent many hour yesterday working to resolve a problem where the tests > > where green and the real-world would fail. Eventually I ended up > > restarting WeBrick and things got better. Unfortunately, I have little > > memory of what code I really changed that fixed the problem, so what code > > might not reload automaticaly in DEV mode? > > Any code > > - you use require to load (use require_dependency) > - that is loaded by your environment.rb or (development|production).rb > files - that you loaded during on request, and then removed the line which > loaded the file >Thanks. I wasn''t aware of require_dependency, which is probably the source of the problem. I had thought they''d just ''override'' the original require method. Any reason it wasn''t done that way? David
David Corbin wrote:>Thanks. I wasn''t aware of require_dependency, which is probably the source of >the problem. I had thought they''d just ''override'' the original require >method. Any reason it wasn''t done that way? > >- Some things you don''t want to reload each request - RubyGems already overrides require
On Tuesday 07 June 2005 07:20 pm, Nicholas Seckar wrote:> David Corbin wrote: > >Thanks. I wasn''t aware of require_dependency, which is probably the > > source of the problem. I had thought they''d just ''override'' the original > > require method. Any reason it wasn''t done that way? > > - Some things you don''t want to reload each request > - RubyGems already overrides requireWell, but it could look at the file timestamp and only reload those that have changed.
On 6/8/05, David Corbin <dcorbin-wmGZ+vDKSyrZJqsBc5GL+g@public.gmane.org> wrote:> On Tuesday 07 June 2005 07:20 pm, Nicholas Seckar wrote: > > David Corbin wrote: > > >Thanks. I wasn''t aware of require_dependency, which is probably the > > > source of the problem. I had thought they''d just ''override'' the original > > > require method. Any reason it wasn''t done that way? > > > > - Some things you don''t want to reload each request > > - RubyGems already overrides require > > Well, but it could look at the file timestamp and only reload those that have > changed.That would be an awful lot of work to do every request. stats are cheap but they aren''t free. It also breaks the semantics of ''require'' which won''t do anything if the file has already been ''required''.> ______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
On Tuesday 07 June 2005 08:31 pm, Michael Koziarski wrote:> On 6/8/05, David Corbin <dcorbin-wmGZ+vDKSyrZJqsBc5GL+g@public.gmane.org> wrote: > > On Tuesday 07 June 2005 07:20 pm, Nicholas Seckar wrote: > > > David Corbin wrote: > > > >Thanks. I wasn''t aware of require_dependency, which is probably the > > > > source of the problem. I had thought they''d just ''override'' the > > > > original require method. Any reason it wasn''t done that way? > > > > > > - Some things you don''t want to reload each request > > > - RubyGems already overrides require > > > > Well, but it could look at the file timestamp and only reload those that > > have changed. > > That would be an awful lot of work to do every request. stats are > cheap but they aren''t free. > > It also breaks the semantics of ''require'' which won''t do anything if > the file has already been ''required''.Maybe so, but only in development mode. I think it would be worthwhile...