when i run rake tasks, i run into a strange problem when running it in production mode. it loads all of the files in the directory app/ runners/cron. when i run the rake task with config.cache_classes set to true (as it is set in environment/production.rb) then it seems to load those files in that directory upon execution of the rake command. however, those files are not loaded when it is set to false. i have checked my application, boot, and environment files and i am not loading that directory. i came across this error trying to run a thinking_sphinx rake task as below: http://groups.google.com/group/thinking-sphinx/browse_thread/thread/b35782f90d7605fa -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Jan 31, 2011 at 3:48 AM, tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> when i run rake tasks, i run into a strange problem when running it in > production mode. it loads all of the files in the directory app/ > runners/cron. when i run the rake task with config.cache_classes set > to true (as it is set in environment/production.rb) then it seems to > load those files in that directory upon execution of the rake command. > however, those files are not loaded when it is set to false. > > i have checked my application, boot, and environment files and i am > not loading that directory.Can you reproduce it in a minimal application? I see from the other thread that the application runs Rails 3. Just in case it was migrated from Rails 2 let me comment that in Rails 2 custom directories under app are not eager loaded, while they are in Rails 3. In case it rings a bell. Having said that, eager loading is not triggered for bare rake tasks that do not depend on the builtin :environment task. And for tasks that do depend there''s a global flag called $rails_rake_task set to true within :environment that prevents eager loading from being run at all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in any case* unless there''s some custom behavior somewhere. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
So, based on what you are saying, these must be loaded somehow from a custom load that I added? The thing I find confusing though is that should not the same thing happen even if classes are not cached? Are there any other files I should look at to track down where this include might be coming from? Finally, where is the ideal place to put custom files? Thanks for you help. :) On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On Mon, Jan 31, 2011 at 3:48 AM, tashfeen.ekram > > <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > when i run rake tasks, i run into a strange problem when running it in > > production mode. it loads all of the files in the directory app/ > > runners/cron. when i run the rake task with config.cache_classes set > > to true (as it is set in environment/production.rb) then it seems to > > load those files in that directory upon execution of the rake command. > > however, those files are not loaded when it is set to false. > > > i have checked my application, boot, and environment files and i am > > not loading that directory. > > Can you reproduce it in a minimal application? > > I see from the other thread that the application runs Rails 3. Just in > case it was migrated from Rails 2 let me comment that in Rails 2 > custom directories under app are not eager loaded, while they are in > Rails 3. In case it rings a bell. > > Having said that, eager loading is not triggered for bare rake tasks > that do not depend on the builtin :environment task. And for tasks > that do depend there''s a global flag called $rails_rake_task set to > true within :environment that prevents eager loading from being run at > all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > any case* unless there''s some custom behavior somewhere.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Oh, will get back to you on whether this can be reproduced on a minimal app... On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On Mon, Jan 31, 2011 at 3:48 AM, tashfeen.ekram > > <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > when i run rake tasks, i run into a strange problem when running it in > > production mode. it loads all of the files in the directory app/ > > runners/cron. when i run the rake task with config.cache_classes set > > to true (as it is set in environment/production.rb) then it seems to > > load those files in that directory upon execution of the rake command. > > however, those files are not loaded when it is set to false. > > > i have checked my application, boot, and environment files and i am > > not loading that directory. > > Can you reproduce it in a minimal application? > > I see from the other thread that the application runs Rails 3. Just in > case it was migrated from Rails 2 let me comment that in Rails 2 > custom directories under app are not eager loaded, while they are in > Rails 3. In case it rings a bell. > > Having said that, eager loading is not triggered for bare rake tasks > that do not depend on the builtin :environment task. And for tasks > that do depend there''s a global flag called $rails_rake_task set to > true within :environment that prevents eager loading from being run at > all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > any case* unless there''s some custom behavior somewhere.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Feb-01 07:36 UTC
Re: Re: Strange rake error with config.cache_classes
On 31 Jan 2011, at 19:46, "tashfeen.ekram" <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> So, based on what you are saying, these must be loaded somehow from a > custom load that I added? > > The thing I find confusing though is that should not the same thing > happen even if classes are not cached? >class_caching is the thing that triggers whether application classes should be automatically loaded.> Are there any other files I should look at to track down where this > include might be coming from? >I''d double check nothing is playing with eager_load_paths (which is those paths to be loaded ahead of time) Fred> Finally, where is the ideal place to put custom files? > > Thanks for you help. :) > > On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: >> On Mon, Jan 31, 2011 at 3:48 AM, tashfeen.ekram >> >> <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>> when i run rake tasks, i run into a strange problem when running it in >>> production mode. it loads all of the files in the directory app/ >>> runners/cron. when i run the rake task with config.cache_classes set >>> to true (as it is set in environment/production.rb) then it seems to >>> load those files in that directory upon execution of the rake command. >>> however, those files are not loaded when it is set to false. >> >>> i have checked my application, boot, and environment files and i am >>> not loading that directory. >> >> Can you reproduce it in a minimal application? >> >> I see from the other thread that the application runs Rails 3. Just in >> case it was migrated from Rails 2 let me comment that in Rails 2 >> custom directories under app are not eager loaded, while they are in >> Rails 3. In case it rings a bell. >> >> Having said that, eager loading is not triggered for bare rake tasks >> that do not depend on the builtin :environment task. And for tasks >> that do depend there''s a global flag called $rails_rake_task set to >> true within :environment that prevents eager loading from being run at >> all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in >> any case* unless there''s some custom behavior somewhere. > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
is there a way to output the eager_load_path? i added the following line to one of the files that is mistakely loaded: puts @eager_load_paths However, the output is nil. does this mean nothing is being eagerly loaded? On Feb 1, 2:36 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 31 Jan 2011, at 19:46, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > So, based on what you are saying, these must be loaded somehow from a > > custom load that I added? > > > The thing I find confusing though is that should not the same thing > > happen even if classes are not cached? > > class_caching is the thing that triggers whether application classes should be automatically loaded. > > > Are there any other files I should look at to track down where this > > include might be coming from? > > I''d double check nothing is playing with eager_load_paths (which is those paths to be loaded ahead of time) > > Fred > > > Finally, where is the ideal place to put custom files? > > > Thanks for you help. :) > > > On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: > >> On Mon, Jan 31, 2011 at 3:48 AM,tashfeen.ekram > > >> <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >>> when i run rake tasks, i run into a strange problem when running it in > >>> production mode. it loads all of the files in the directory app/ > >>> runners/cron. when i run the rake task with config.cache_classes set > >>> to true (as it is set in environment/production.rb) then it seems to > >>> load those files in that directory upon execution of the rake command. > >>> however, those files are not loaded when it is set to false. > > >>> i have checked my application, boot, and environment files and i am > >>> not loading that directory. > > >> Can you reproduce it in a minimal application? > > >> I see from the other thread that the application runs Rails 3. Just in > >> case it was migrated from Rails 2 let me comment that in Rails 2 > >> custom directories under app are not eager loaded, while they are in > >> Rails 3. In case it rings a bell. > > >> Having said that, eager loading is not triggered for bare rake tasks > >> that do not depend on the builtin :environment task. And for tasks > >> that do depend there''s a global flag called $rails_rake_task set to > >> true within :environment that prevents eager loading from being run at > >> all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > >> any case* unless there''s some custom behavior somewhere. > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I am still struggling with this. Any idea how I can figure out load paths? On Feb 1, 9:28 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> is there a way to output the eager_load_path? > > i added the following line to one of the files that is mistakely > loaded: > > puts @eager_load_paths > > However, the output is nil. does this mean nothing is being eagerly > loaded? > > On Feb 1, 2:36 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > > > > On 31 Jan 2011, at 19:46, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > So, based on what you are saying, these must be loaded somehow from a > > > custom load that I added? > > > > The thing I find confusing though is that should not the same thing > > > happen even if classes are not cached? > > > class_caching is the thing that triggers whether application classes should be automatically loaded. > > > > Are there any other files I should look at to track down where this > > > include might be coming from? > > > I''d double check nothing is playing with eager_load_paths (which is those paths to be loaded ahead of time) > > > Fred > > > > Finally, where is the ideal place to put custom files? > > > > Thanks for you help. :) > > > > On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: > > >> On Mon, Jan 31, 2011 at 3:48 AM,tashfeen.ekram > > > >> <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>> when i run rake tasks, i run into a strange problem when running it in > > >>> production mode. it loads all of the files in the directory app/ > > >>> runners/cron. when i run the rake task with config.cache_classes set > > >>> to true (as it is set in environment/production.rb) then it seems to > > >>> load those files in that directory upon execution of the rake command. > > >>> however, those files are not loaded when it is set to false. > > > >>> i have checked my application, boot, and environment files and i am > > >>> not loading that directory. > > > >> Can you reproduce it in a minimal application? > > > >> I see from the other thread that the application runs Rails 3. Just in > > >> case it was migrated from Rails 2 let me comment that in Rails 2 > > >> custom directories under app are not eager loaded, while they are in > > >> Rails 3. In case it rings a bell. > > > >> Having said that, eager loading is not triggered for bare rake tasks > > >> that do not depend on the builtin :environment task. And for tasks > > >> that do depend there''s a global flag called $rails_rake_task set to > > >> true within :environment that prevents eager loading from being run at > > >> all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > > >> any case* unless there''s some custom behavior somewhere. > > > > -- > > > 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-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm. > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Also, when I run the below rkae command that is run in the production environment I do not get the same error. rake db:migrate RAILS_ENV=production Should the above command also be caching the classes and cause me to surface the same problem? On Feb 5, 12:49 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am still struggling with this. Any idea how I can figure out load > paths? > > On Feb 1, 9:28 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > is there a way to output the eager_load_path? > > > i added the following line to one of the files that is mistakely > > loaded: > > > puts @eager_load_paths > > > However, the output is nil. does this mean nothing is being eagerly > > loaded? > > > On Feb 1, 2:36 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > > > > On 31 Jan 2011, at 19:46, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > So, based on what you are saying, these must be loaded somehow from a > > > > custom load that I added? > > > > > The thing I find confusing though is that should not the same thing > > > > happen even if classes are not cached? > > > > class_caching is the thing that triggers whether application classes should be automatically loaded. > > > > > Are there any other files I should look at to track down where this > > > > include might be coming from? > > > > I''d double check nothing is playing with eager_load_paths (which is those paths to be loaded ahead of time) > > > > Fred > > > > > Finally, where is the ideal place to put custom files? > > > > > Thanks for you help. :) > > > > > On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: > > > >> On Mon, Jan 31, 2011 at 3:48 AM,tashfeen.ekram > > > > >> <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > >>> when i run rake tasks, i run into a strange problem when running it in > > > >>> production mode. it loads all of the files in the directory app/ > > > >>> runners/cron. when i run the rake task with config.cache_classes set > > > >>> to true (as it is set in environment/production.rb) then it seems to > > > >>> load those files in that directory upon execution of the rake command. > > > >>> however, those files are not loaded when it is set to false. > > > > >>> i have checked my application, boot, and environment files and i am > > > >>> not loading that directory. > > > > >> Can you reproduce it in a minimal application? > > > > >> I see from the other thread that the application runs Rails 3. Just in > > > >> case it was migrated from Rails 2 let me comment that in Rails 2 > > > >> custom directories under app are not eager loaded, while they are in > > > >> Rails 3. In case it rings a bell. > > > > >> Having said that, eager loading is not triggered for bare rake tasks > > > >> that do not depend on the builtin :environment task. And for tasks > > > >> that do depend there''s a global flag called $rails_rake_task set to > > > >> true within :environment that prevents eager loading from being run at > > > >> all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > > > >> any case* unless there''s some custom behavior somewhere. > > > > > -- > > > > 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@googlegroups.com. > > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
finally figured it out. it is a features of rails 3.0. http://edgeguides.rubyonrails.org/configuring.html "config.eager_load_paths accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the app directory of the application. All elements of this array must also be in load_paths." On Feb 5, 1:02 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Also, when I run the below rkae command that is run in the production > environment I do not get the same error. > > rake db:migrate RAILS_ENV=production > > Should the above command also be caching the classes and cause me to > surface the same problem? > > On Feb 5, 12:49 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I am still struggling with this. Any idea how I can figure out load > > paths? > > > On Feb 1, 9:28 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > is there a way to output the eager_load_path? > > > > i added the following line to one of the files that is mistakely > > > loaded: > > > > puts @eager_load_paths > > > > However, the output is nil. does this mean nothing is being eagerly > > > loaded? > > > > On Feb 1, 2:36 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > > wrote: > > > > > On 31 Jan 2011, at 19:46, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8@public.gmane.orgm> wrote: > > > > > > So, based on what you are saying, these must be loaded somehow from a > > > > > custom load that I added? > > > > > > The thing I find confusing though is that should not the same thing > > > > > happen even if classes are not cached? > > > > > class_caching is the thing that triggers whether application classes should be automatically loaded. > > > > > > Are there any other files I should look at to track down where this > > > > > include might be coming from? > > > > > I''d double check nothing is playing with eager_load_paths (which is those paths to be loaded ahead of time) > > > > > Fred > > > > > > Finally, where is the ideal place to put custom files? > > > > > > Thanks for you help. :) > > > > > > On Jan 31, 4:26 am, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: > > > > >> On Mon, Jan 31, 2011 at 3:48 AM,tashfeen.ekram > > > > > >> <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > >>> when i run rake tasks, i run into a strange problem when running it in > > > > >>> production mode. it loads all of the files in the directory app/ > > > > >>> runners/cron. when i run the rake task with config.cache_classes set > > > > >>> to true (as it is set in environment/production.rb) then it seems to > > > > >>> load those files in that directory upon execution of the rake command. > > > > >>> however, those files are not loaded when it is set to false. > > > > > >>> i have checked my application, boot, and environment files and i am > > > > >>> not loading that directory. > > > > > >> Can you reproduce it in a minimal application? > > > > > >> I see from the other thread that the application runs Rails 3. Just in > > > > >> case it was migrated from Rails 2 let me comment that in Rails 2 > > > > >> custom directories under app are not eager loaded, while they are in > > > > >> Rails 3. In case it rings a bell. > > > > > >> Having said that, eager loading is not triggered for bare rake tasks > > > > >> that do not depend on the builtin :environment task. And for tasks > > > > >> that do depend there''s a global flag called $rails_rake_task set to > > > > >> true within :environment that prevents eager loading from being run at > > > > >> all. Thus, as far as rake tasks is concerned, it shouldn''t happen *in > > > > >> any case* unless there''s some custom behavior somewhere. > > > > > > -- > > > > > 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@googlegroups.com. > > > > > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Feb 5, 2011 at 8:39 PM, tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> finally figured it out. it is a features of rails 3.0. > > http://edgeguides.rubyonrails.org/configuring.html > > "config.eager_load_paths accepts an array of paths from which Rails > will eager load on boot if cache classes is enabled. Defaults to every > folder in the app directory of the application. All elements of this > array must also be in load_paths."Yes, I commented it above. But eager loading does NOT happen on rake tasks no matter the environment. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ahhh. Now, I understand your comment but this also confuses me. 1. rake thinking_sphinx:configure no prob 2. rake thinking_sphinx:configure RAILS_ENV=production problem 3. rake db:migrate no prob 4. rake db:migrate RAILS_ENV=production no prob I guess I am confused why the same problem would not surface when running command 4. Also, I can run command 2 and change in environments/production.rb cache_classes to false (rather than the default of true) and then the problem goes away. It seems like changing cache_classes should not change rake behavior?? Or is there some condition in the rest of the app that is including it based on whether classes are or not cached? On Feb 5, 3:17 pm, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote:> On Sat, Feb 5, 2011 at 8:39 PM,tashfeen.ekram <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > finally figured it out. it is a features of rails 3.0. > > >http://edgeguides.rubyonrails.org/configuring.html > > > "config.eager_load_paths accepts an array of paths from which Rails > > will eager load on boot if cache classes is enabled. Defaults to every > > folder in the app directory of the application. All elements of this > > array must also be in load_paths." > > Yes, I commented it above. > > But eager loading does NOT happen on rake tasks no matter the environment.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I created a basic app with nothing else except a gem file and those files being loaded in the "app/runners/cron" directory and it does appear to reproduce the error. On Feb 5, 5:32 pm, "tashfeen.ekram" <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ahhh. Now, I understand your comment but this also confuses me. > > 1. rake thinking_sphinx:configure > no prob > > 2. rake thinking_sphinx:configure RAILS_ENV=production > problem > > 3. rake db:migrate > no prob > > 4. rake db:migrate RAILS_ENV=production > no prob > > I guess I am confused why the same problem would not surface when > running command 4. Also, I can run command 2 and change in > environments/production.rb cache_classes to false (rather than the > default of true) and then the problem goes away. > > It seems like changing cache_classes should not change rake behavior?? > Or is there some condition in the rest of the app that is including it > based on whether classes are or not cached? > > On Feb 5, 3:17 pm, Xavier Noria <f...-xlncskNFVEJBDgjK7y7TUQ@public.gmane.org> wrote: > > > > > > > > > On Sat, Feb 5, 2011 at 8:39 PM,tashfeen.ekram <tashfeen.ek...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > finally figured it out. it is a features of rails 3.0. > > > >http://edgeguides.rubyonrails.org/configuring.html > > > > "config.eager_load_paths accepts an array of paths from which Rails > > > will eager load on boot if cache classes is enabled. Defaults to every > > > folder in the app directory of the application. All elements of this > > > array must also be in load_paths." > > > Yes, I commented it above. > > > But eager loading does NOT happen on rake tasks no matter the environment.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Sat, Feb 5, 2011 at 11:32 PM, tashfeen.ekram <tashfeen.ekram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ahhh. Now, I understand your comment but this also confuses me. > > 1. rake thinking_sphinx:configure > no prob > > 2. rake thinking_sphinx:configure RAILS_ENV=production > problem > > 3. rake db:migrate > no prob > > 4. rake db:migrate RAILS_ENV=production > no prob > > I guess I am confused why the same problem would not surface when > running command 4.If you define a rake task that depends on the :environment builtin task no eager loading is triggered.> Also, I can run command 2 and change in > environments/production.rb cache_classes to false (rather than the > default of true) and then the problem goes away.Because cache_classes is a necessary condition for eager loading. If you set cache_classes to false no eager loading will happen (unless forced of course). But it is not a sufficient condition: even if cache_classes is true, db:migrate and friends won''t trigger eager loading. Could you come up with a self-contained minimal application that reproduces the issue? Eg, an application with one exact model and one exact file in app/runners/cron or whatever and the plugin installed under vendor. Put puts "loading #{__FILE__}" at the top of each of them. Then two one-liners that demonstrate the problem. If you upload a tarball with that I''ll have a look at it. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I''ve run into a similar issue where a variable contained nil when it should always be an array (the controller ensures this, the view is where the error was raised.) Anyways, setting "config.eager_load_paths = false" appears to fix the issue which only occurs when "config.cache_classes = true". It seems eager loading has to do with using :include in a find query, taking out all such includes fixed the problem for me. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.